Why does the interactive Python interpreter in PyPy have a slightly different command-line interface?

1 week ago 15
ARTICLE AD BOX

In any implementation or runtime, the REPL prompt is customizable by setting sys.ps1:

$ python3 Python 3.14.2 | packaged by conda-forge | (main, Dec 6 2025, 12:35:48) [Clang 20.1.8 ] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.ps1 = "🐍🐍🐍 " 🐍🐍🐍 print("no step on snek") no step on snek 🐍🐍🐍

PyPy changes the default prompts as a convenience to visually indicate that you're interacting within a PyPy REPL not a CPython REPL.

The override was originally added by Armin in 2004 (c5c8e80) with the commit message:

Added sys.ps1 and sys.ps2, with an extra character as a help to distinguish between levels.

The initial release of PyPy came years later in 2007, so custom prompts have been there since the very beginning. A lot has changed in the decades since, and the startup code which does that currently is found in lib_pypy/_pypy_interact.py.

wim's user avatar

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.

Read Entire Article