Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions python-repl-314/.pythonstartup
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
try:
from dataclasses import replace

from _colorize import ANSIColors, default_theme, set_theme
except Exception:
# Running on an older Python or environment without _colorize
pass
else:
theme = default_theme.copy_with(
syntax=replace(
default_theme.syntax,
keyword=ANSIColors.BOLD_YELLOW,
string=ANSIColors.INTENSE_BLUE,
number=ANSIColors.RED,
comment=ANSIColors.GREY,
),
)
set_theme(theme)
3 changes: 3 additions & 0 deletions python-repl-314/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Python 3.14 Preview: REPL Autocompletion and Highlighting

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/).
21 changes: 21 additions & 0 deletions python-repl-314/syntax_highlighting_sample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import pathlib

BASE_DIR = pathlib.Path(".")
number = 42
fruits = ["apple", "grape", "orange"]


def func(value):
"""A sample docstring."""
return f"The input value is: {value}"


def main():
# A sample comment
func(number)
for fruit in fruits:
print(fruit)


if __name__ == "__main__":
main()