Skip to content

Commit 8e12f26

Browse files
author
Carlos
committed
Add introductory sections to built-in function documentation
- Added introductory explanations for the following built-in functions: - any() - ascii() - bin() - bool() - breakpoint() - classmethod() - compile() - complex() - delattr() - dict() - dir() - divmod() - enumerate() - eval() - exec() - filter() - float() - format() - frozenset() - getattr() - globals() - hasattr() - hash() - help() - hex() - id() - import() - input() - int() - isinstance() - issubclass() - iter() - len() - list() - locals() - map() - max() - memoryview() - min() - next() - object() - oct() - open() - ord() - pow() - print() - property() - range() - repr() - reversed() - round() - set() - setattr() - slice() - sorted() - staticmethod() - str() - sum() - super() - tuple() - type() - vars() - zip()
1 parent dc9c4e2 commit 8e12f26

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+192
-27
lines changed

docs/builtin/abs.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Python abs() built-in function
1616
</base-disclaimer-content>
1717
</base-disclaimer>
1818

19+
## Introduction
20+
21+
The `abs()` function in Python is a built-in function that returns the absolute value of a number. It can handle integers, floating-point numbers, and even complex numbers (returning their magnitude). This function is useful when you need to ensure a value is positive, regardless of its original sign.
22+
1923
```python
2024
>>> abs(-1)
2125
# 1

docs/builtin/aiter.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Python aiter() built-in function
1616
</base-disclaimer-content>
1717
</base-disclaimer>
1818

19+
## Introduction
20+
21+
The `aiter()` function in Python is a built-in function that returns an asynchronous iterator for an asynchronous iterable. This is the asynchronous equivalent of the `iter()` function and is essential when working with asynchronous loops (`async for`). It allows you to iterate over objects that produce values asynchronously.
22+
1923
## Example
2024

2125
```python

docs/builtin/all.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Python all() built-in function
1616
</base-disclaimer-content>
1717
</base-disclaimer>
1818

19+
## Introduction
20+
21+
The `all()` function in Python is a built-in function that checks if all elements in an iterable are `True`. It returns `True` if every element evaluates to true, or if the iterable is empty. This is useful for validating conditions across a collection of items, such as checking if all numbers in a list are positive or if all required fields in a form are filled.
22+
1923
## Examples
2024

2125
```python

docs/builtin/any.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Python any() built-in function
1616
</base-disclaimer-content>
1717
</base-disclaimer>
1818

19+
## Introduction
20+
21+
The `any()` function in Python is a built-in function that checks if at least one element in an iterable is `True`. It returns `True` if any element evaluates to true, and `False` if the iterable is empty or all elements are false. This is useful for quickly determining if a condition is met by any item in a collection.
22+
1923
## Examples
2024

2125
```python

docs/builtin/ascii.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Python ascii() built-in function
1616
</base-disclaimer-content>
1717
</base-disclaimer>
1818

19+
## Introduction
20+
21+
The `ascii()` function in Python is a built-in function that returns a string containing a printable representation of an object, similar to `repr()`. However, `ascii()` escapes any non-ASCII characters with `\x`, `\u`, or `\U` escape sequences. This is useful for ensuring that a string is safe to be used in an ASCII-only environment.
22+
1923
## Examples
2024

2125
```python

docs/builtin/bin.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Python bin() built-in function
1616
</base-disclaimer-content>
1717
</base-disclaimer>
1818

19+
## Introduction
20+
1921
The `bin()` function converts an integer into its binary representation. The resulting string is prefixed with "0b" to indicate that it's a binary number.
2022

2123
### Examples

docs/builtin/bool.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Python bool() built-in function
1616
</base-disclaimer-content>
1717
</base-disclaimer>
1818

19+
## Introduction
20+
21+
The `bool()` function in Python is a built-in function that converts a value to a Boolean (`True` or `False`). It follows the standard truth testing procedure, where values like `0`, `None`, and empty collections are considered `False`, while most other values are `True`. This is fundamental for controlling the flow of your program with conditional statements.
22+
1923
## Examples
2024

2125
```python

docs/builtin/breakpoint.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ Python breakpoint() built-in function
1818
</base-disclaimer-content>
1919
</base-disclaimer>
2020

21+
## Introduction
22+
23+
The `breakpoint()` function in Python, introduced in Python 3.7, provides an easy way to enter the Python debugger (`pdb`) at a specific point in your code. It's a convenient alternative to manually importing `pdb` and calling `pdb.set_trace()`. This function simplifies the debugging process, allowing you to inspect variables and step through your code interactively.
24+
2125
## Example
2226

2327
```python

docs/builtin/classmethod.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Python classmethod() built-in function
1616
</base-disclaimer-content>
1717
</base-disclaimer>
1818

19+
## Introduction
20+
1921
A `classmethod` is a method that is bound to the class and not the instance of the class. It takes the class itself as its first argument, conventionally named `cls`. This is in contrast to a regular instance method, which takes the instance as its first argument (`self`).
2022

2123
They are often used for factory methods that create instances of the class in a specific way.

docs/builtin/compile.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ Python compile() built-in function
1616
</base-disclaimer-content>
1717
</base-disclaimer>
1818

19+
## Introduction
20+
1921
The `compile()` function in Python is a built-in function that is used to convert a string or an Abstract Syntax Tree (AST) object into a code object. This code object can then be executed by functions like <router-link to="/builtin/exec">exec()</router-link> or <router-link to="/builtin/eval">eval()</router-link>.
2022

2123
## Example
2224

25+
```python
2326
Here's a basic example of how it works:
2427

2528
```python

0 commit comments

Comments
 (0)