Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9d60688

Browse files
committed
Enhance documentation for built-in functions by adding "See also" sections with related functions
1 parent8e12f26 commit9d60688

File tree

12 files changed

+54
-3
lines changed

12 files changed

+54
-3
lines changed

‎docs/builtin/compile.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ The `compile()` function in Python is a built-in function that is used to conver
2222

2323
##Example
2424

25-
```python
2625
Here's a basic example of how it works:
2726

2827
```python
@@ -51,4 +50,9 @@ code_obj = compile('hello_world()', '<string>', 'exec')
5150
exec(code_obj)
5251
```
5352

54-
In this example, a string containing Python code is compiled into a code object using`compile()`, and then executed with`exec()`. The function`hello_world()` defined in the string is then available to be called.
53+
In this example, a string containing Python code is compiled into a code object using`compile()`, and then executed with`exec()`. The function`hello_world()` defined in the string is then available to be called.
54+
55+
##See also
56+
57+
- <router-linkto="/builtin/exec">exec()</router-link>
58+
- <router-linkto="/builtin/eval">eval()</router-link>

‎docs/builtin/complex.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,8 @@ print(complex(5)) # Output: (5+0j)
3232
# Create a complex number from a string
3333
print(complex("2+3j"))# Output: (2+3j)
3434
```
35+
36+
##See also
37+
38+
- <router-linkto="/builtin/int">`int()`</router-link>
39+
- <router-linkto="/builtin/float">`float()`</router-link>

‎docs/builtin/delattr.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,8 @@ try:
5656
exceptAttributeErroras e:
5757
print(f"Error:{e}")
5858
```
59+
60+
##See also
61+
62+
- <router-linkto="/builtin/setattr">`setattr()`</router-link>
63+
- <router-linkto="/builtin/getattr">`getattr()`</router-link>

‎docs/builtin/dict.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,7 @@ Creating an empty dictionary:
5252
>>>type(a)
5353
# <class 'dict'>
5454
```
55+
56+
##See also
57+
58+
- <router-linkto="/builtin/iter">`iter()`</router-link>

‎docs/builtin/dir.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,8 @@ import math
7171
print([namefor nameindir(math)ifnot name.startswith("__")])
7272
# Output: ['acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', ... ]
7373
```
74+
75+
##See also
76+
77+
- <router-linkto="/builtin/globals">`globals()`</router-link>
78+
- <router-linkto="/builtin/locals">`locals()`</router-link>

‎docs/builtin/eval.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,8 @@ The `eval()` function in Python is a built-in function that parses a string as a
3535
```
3636

3737
The`eval()` function can also be used with the <router-linkto="/builtin/print">print()</router-link> function to display output to the console.
38+
39+
##See also
40+
41+
- <router-linkto="/builtin/compile">`compile()`</router-link>
42+
- <router-linkto="/builtin/exec">`exec()`</router-link>

‎docs/builtin/exec.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,9 @@ exec(code)
103103
```python
104104
user_input=input("Enter code to execute:")
105105
exec(user_input)# Caution: This can be a security risk if not properly sanitized.
106-
```
106+
```
107+
108+
##See also
109+
110+
- <router-linkto="/builtin/compile">`compile()`</router-link>
111+
- <router-linkto="/builtin/eval">`eval()`</router-link>

‎docs/builtin/filter.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,9 @@ The `filter()` function constructs an iterator from those elements of the iterab
4646
```
4747

4848
In this example, the`is_even` function is defined to determine whether a number is even or not. The filter method takes`two arguments`: the`first argument` is the function to apply to each element of the list, and the`second argument` is the list to be filtered. The filter method returns an <router-linkto="/builtin/iter">iterator</router-link>, which is then converted to a list and stored in the even_numbers variable. The final output is the list of even numbers from the original list.
49+
50+
##See also
51+
52+
- <router-linkto="/builtin/map">map()</router-link>: Apply a function to every item of an iterable and return an iterator of the results.
53+
- <router-linkto="/builtin/iter">iter()</router-link>: Return an iterator object.
54+
- <router-linkto="/blog/python-comprehensions-step-by-step">List Comprehensions</router-link>: A concise way to create lists, often used as an alternative to`filter()`.

‎docs/builtin/float.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@ The <router-link to="/builtin/float">float()</router-link> function returns a fl
3030
>>>float(10)
3131
# 10.0
3232
```
33+
34+
##See also
35+
36+
- <router-linkto="/builtin/int/">int()</router-link>
37+
- <router-linkto="/builtin/complex/">complex()</router-link>
38+
- <router-linkto="/blog/python-data-types/">Python Data Types</router-link>

‎docs/builtin/format.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@ print("My name is {0} and I work for {1}.".format(name, company))
3333
# Formatting string (faster and easier)
3434
print(f"My name is{name} and I work for{company}.")
3535
```
36+
37+
##See also
38+
39+
- <router-linkto="/builtin/str/">str()</router-link>
40+
- <router-linkto="/cheatsheet/strings/">Strings Cheatsheet</router-link>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp