3 ms·
Python 3.13 Preview: A Modern REPL – Real Python
- zahlman 2y agoThings that are actually new here: * Auto-detection of colour support and use of coloured output * `help`/`exit`/`quit` are now recognized by the interpreter, rather than just being builtin names that have to be called in Python * a `clear` command is added along the same lines (not explained: how does this interact with the scrollback buffer?) * The F1 key also activates the help * readline history can treat multi-line statements/expressions as a single entry * The REPL detects when code is being pasted, so that blank lines aren't treated as "end of block" and `input` doesn't run immediately (on what's supposed to be the next line of code). That last one is huge IMO; it's historically been (as far as I can tell) the source of a large number of poorly-asked questions on Stack Overflow where the community is confused about the problem description or claims not to be able to reproduce it (because OP maybe doesn't even know what a REPL is and therefore can't properly explain it). Also, apparently there's some kind of history browser (I don't know why; it seems easy enough to just scroll the window) and "paste mode" (the author doesn't seem to know what this actually does and I can't guess either). The help browser already existed, of course, as did the REPL as a general concept and the various built-in Python functionality shown. The article is padded out quite a bit because it's presented as a tutorial rather than as news.
- deleted 2y ago[deleted]