learning and experimenting python.

Steve D'Aprano steve+python at pearwood.info
Fri Dec 30 19:44:48 EST 2016


On Sat, 31 Dec 2016 05:51 am, BartC wrote:

> In usenet posts >>> gets confused for quoted material 3 levels deep
> (which on my newsreader is shown as coloured vertical bars on the left).


Indeed, which is why my Python startup file contains this:



# Change the main prompt. Consider using '≻≻≻ '?
# This is non-portable and may not work everywhere.
if (sys.version_info[0] >= 3 and os.name == 'posix'
    and os.environ['TERM'] in ['xterm', 'vt100']):
    # Make the prompt bold in Python 3.
    sys.ps1 = '\001\x1b[1m\002py> \001\x1b[0m\002'
    sys.ps2 = '\001\x1b[1m\002... \001\x1b[0m\002'
else:
    sys.ps1 = 'py> '


That gives me a "py>" prompt, bolded in Python 3 and plain in Python 2.




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list