Skip to content

Commit 0380626

Browse files
authored
Merge pull request #695 from realpython/python-repl-314
Sample code: 3.14's REPL
2 parents 8e4a5c8 + f72327b commit 0380626

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

python-repl-314/.pythonstartup

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
try:
2+
from dataclasses import replace
3+
4+
from _colorize import ANSIColors, default_theme, set_theme
5+
except Exception:
6+
# Running on an older Python or environment without _colorize
7+
pass
8+
else:
9+
theme = default_theme.copy_with(
10+
syntax=replace(
11+
default_theme.syntax,
12+
keyword=ANSIColors.BOLD_YELLOW,
13+
string=ANSIColors.INTENSE_BLUE,
14+
number=ANSIColors.RED,
15+
comment=ANSIColors.GREY,
16+
),
17+
)
18+
set_theme(theme)

python-repl-314/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Python 3.14 Preview: REPL Autocompletion and Highlighting
2+
3+
This folder provides the code examples for the Real Python tutorial [Python 3.14 Preview: REPL Autocompletion and Highlighting](https://realpython.com/python-repl-autocompletion-highlighting/).
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import pathlib
2+
3+
BASE_DIR = pathlib.Path(".")
4+
number = 42
5+
fruits = ["apple", "grape", "orange"]
6+
7+
8+
def func(value):
9+
"""A sample docstring."""
10+
return f"The input value is: {value}"
11+
12+
13+
def main():
14+
# A sample comment
15+
func(number)
16+
for fruit in fruits:
17+
print(fruit)
18+
19+
20+
if __name__ == "__main__":
21+
main()

0 commit comments

Comments
 (0)