After 15 years of everyone bitching about the garbage REPL, Python 3.13 finally ships a REPL that doesn't make you want to immediately switch to IPython. Based on PyREPL from the PyPy project, the new interactive interpreter includes features that should have existed in 2009.
Multi-line Editing That Doesn't Break Your Brain
Multi-line editing was broken as hell. Try editing a function and watch it... well, you couldn't edit anything. Just retype the whole thing like some kind of caveman. Python 3.13 finally lets you use arrow keys like every other program since 1999.
Took them long enough.
What actually works now:
- Arrow keys navigate within code blocks - Finally works like every other editor
- Edit anywhere in history - Select a previous command and modify it without retyping everything
## This actually works in the new REPL without breaking
def calculate_fibonacci(n):
if n <= 1:
return n
return calculate_fibonacci(n-1) + calculate_fibonacci(n-2)
Here's what works now: The PEP 762 specification has all the technical details if you're into that, but basically you can finally edit multi-line Python code without wanting to throw your laptop out a window.
Syntax Highlighting and Visual Improvements
Python 3.13 adds colored syntax highlighting to both the REPL and error tracebacks. Keywords are blue, strings are green, comments are gray - basic stuff that most terminals supported ages ago but Python somehow never bothered with.
Color support:
- Keywords are blue, strings are green - Basic stuff that should have existed years ago
- Error messages in red - Finally easy to spot what's broken
- Set
PYTHON_COLORS=0
to disable if your terminal looks like garbage
The coloring works in most modern terminals - Windows Terminal, iTerm2, and whatever Linux uses these days. If you're still using some ancient terminal from 2003, set PYTHON_COLORS=0
and live with monochrome text.
Update to Python 3.13.1 if colors look fucked - they fixed some terminal bugs.
Copy and Paste That Doesn't Massacre Your Code
The old REPL's copy-paste behavior was criminally bad. Paste a function definition and watch it execute line by line, throwing syntax errors for incomplete code. Python 3.13 implements bracketed paste mode where supported, automatically detecting multi-line pastes and handling them properly.
Paste improvements:
- Bracketed paste mode - Modern terminals detect paste operations automatically
- Manual paste mode (F3) - Press F3 for problematic terminals
- No premature execution - Multi-line blocks wait for you to press Enter
## This pastes correctly now instead of executing line by line
class DataProcessor:
def __init__(self, data):
self.data = data
def process(self):
return [item.strip().lower() for item in self.data if item]
For terminals that don't support bracketed paste, hit F3 to enter manual paste mode. The prompt changes to (paste)
and you can paste multi-line code safely. Hit F3 again to exit paste mode, then Enter to execute.
SSH breaks bracketed paste half the time. Just use F3 and move on.
History and Search Functionality
The new REPL includes proper history search that works across multiple sessions. Use Ctrl+R for reverse search and Ctrl+S for forward search, just like bash or zsh. History persists across Python sessions and supports both substring matching and prefix filtering.
History features:
- Reverse search (Ctrl+R) - Find previous commands like bash
- Multi-line history - Function definitions saved as complete units
History gets stored where it's supposed to on Unix systems and in the right user folder on Windows.
Custom Commands and Exit Behavior
Python's exit
command has confused beginners for 15 years. Type exit
and Python helpfully tells you to type exit()
instead. The new REPL implements proper exit commands that work intuitively.
Improved command handling:
exit
andquit
work without parentheses - Finally behaves like every other shell- Better help system -
help
command actually helps
What Still Sucks
The new REPL is pretty good, but let's not pretend it's perfect:
- No readline configuration support - Your
.inputrc
customizations won't work - Limited customization - Color schemes and key bindings aren't configurable yet
- Some terminal incompatibilities - Older or exotic terminals may have display issues
- Performance overhead - Written in Python instead of C, so it's slightly slower
The Python documentation acknowledges that readline configuration won't be supported, which affects users with extensive customizations.
IDE and Editor Integration
Python 3.13's improvements extend beyond the standalone REPL. IDEs and editors are starting to integrate the enhanced interactive features:
VS Code Integration:
- Python extension updates support the new REPL features
- Improved syntax highlighting in interactive Python terminals
- Better handling of multi-line code execution
PyCharm Support:
- JetBrains updated PyCharm to work with Python 3.13's REPL changes
- Console improvements mirror the standalone REPL enhancements
- Better debugging integration with colored tracebacks
Terminal Integration:
- Works properly in Windows Terminal, iTerm2, and most Linux terminal emulators
- tmux and GNU Screen compatibility
- SSH sessions maintain REPL functionality when terminal supports it
This is the first time I haven't immediately installed IPython after setting up Python. That's saying something.
But the REPL isn't the only thing they fixed. Error messages finally don't suck either.