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

Commit910834f

Browse files
committed
Add compile built-in function and update timeAgo date
1 parentca923db commit910834f

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

‎docs/builtin/compile.md‎

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

19-
<!-- remove this tag to start editing this page-->
20-
<empty-section />
21-
<!-- remove this tag to start editing this page-->
19+
##Introduction
20+
21+
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`exec()` or`eval()`.
22+
23+
##Example
24+
25+
Here's a basic example of how it works:
26+
27+
```python
28+
code_string="""
29+
def hello_world():
30+
print('Hello, world!')
31+
"""
32+
33+
# Compile the string into a code object
34+
code_object=compile(code_string,'<string>','exec')
35+
36+
# Execute the code object
37+
exec(code_object)
38+
39+
# Call the function defined in the code object
40+
hello_world()
41+
```
42+
43+
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.

‎src/components/layout/TheNavbar.vue‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const navigation=useNavigationStore()
33
const route=useRoute()
44
5-
const timeAgo=useTimeAgo(newDate(2023,11,2,12,0))
5+
const timeAgo=useTimeAgo(newDate(2023,12,18,11,0))
66
</script>
77

88
<template>
@@ -42,9 +42,10 @@ const timeAgo = useTimeAgo(new Date(2023, 11, 2, 12, 0))
4242
</span>
4343
</template>
4444
<template #message>
45-
Recently added
45+
Last Update
4646
<spanclass="mx-1">·</span>
47-
Website dependencies
47+
Compile build-in function
48+
<!-- ✨ Compile build-in function-->
4849
</template>
4950
</base-badge-notice>
5051
</router-link>

‎src/pages/changelog.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Changelog
1111

1212
##2024-01-18
1313

14+
- Added compile built-in function.
1415
- Added Augmented Assignment Operators. Thanks[@richjohnsonxyz](https://github.com/richjohnsonxyz)
1516
- Updated dependencies to the latest versions.
1617

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp