Python 3.13's best new features (via) Trey Hunner highlights some Python 3.13 usability improvements I had missed, mainly around the new REPL.
Pasting a block of code like a class or function that includes blank lines no longer breaks in the REPL - particularly useful if you frequently have LLMs write code for you to try out.
Hitting F2 in the REPL toggles "history mode" which gives you your Python code without the REPL's >>>
and ...
prefixes - great for copying code back out again.
Creating a virtual environment with python3.13 -m venv .venv
now adds a .venv/.gitignore
file containing *
so you don't need to explicitly ignore that directory. I just checked and it looks like uv venv
implements the same trick.
And my favourite:
Historically, any line in the Python debugger prompt that started with a PDB command would usually trigger the PDB command, instead of PDB interpreting the line as Python code. [...]
But now, if the command looks like Python code,
pdb
will run it as Python code!
Which means I can finally call list(iterable)
in my pdb
seesions, where previously I've had to use [i for i in iterable]
instead.
(Tip from Trey: !list(iterable)
and [*iterable]
are good alternatives for pre-Python 3.13.)
Trey's post is also available as a YouTube video.
Recent articles
- My AI/LLM predictions for the next 1, 3 and 6 years, for Oxide and Friends - 10th January 2025
- Weeknotes: Starting 2025 a little slow - 4th January 2025
- I still don't think companies serve you ads based on spying through your microphone - 2nd January 2025