This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Zero
Recipients Zero, taleinat, terry.reedy
Date 2019-10-31.13:58:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The documentation for sys.ps1 and sys.ps2 states that they "are only defined if the interpreter is in interactive mode." Since the IDLE shell is meant to be interactive (and to reduce the differences between the shell and running Python directly), would it be helpful if ps1 and ps2 were defined when running IDLE? The shell could then honor their values.

If such a direction was explored, one issue may be that the sidebar could not simply be 3 char wide. The documentation also states that non-strings are evaluated each time they are needed by the interpreter. This allows for such interesting possibilities as shown with the code below but may not be desired functionality for the IDLE shell window.

import sys
from datetime import datetime

class TimePrompt:
    def __init__(self, prefix, suffix):
        self.prefix, self.suffix = prefix, suffix
    def __str__(self):
        return f'{self.prefix}{}{self.suffix}'

sys.ps1, sys.ps2 = TimePrompt('', ' >>> '), TimePrompt('', ' ... ')
Date User Action Args
2019-10-31 13:58:26Zerosetrecipients: + Zero, terry.reedy, taleinat
2019-10-31 13:58:26Zerosetmessageid: <>
2019-10-31 13:58:26Zerolinkissue37903 messages
2019-10-31 13:58:26Zerocreate