[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()
Mark Dickinson
report at bugs.python.org
Wed Jul 14 16:54:53 EDT 2021
Mark Dickinson <dickinsm at gmail.com> added the comment:
> the confusion that it can cause when there is a mismatch between the interactive interpreter and noninteractive execution
I've witnessed similar confusion when teaching, using IPython. After discovering that you can do
In [1]: import pandas as pd
In [2]: cd datafiles
/Users/mdickinson/Desktop/datafiles
In [3]: df = pd.read_csv("experiment0023.csv")
it's then a common error to copy those lines to a script and expect them to work. We learned to recommend that IPython's automagic always be turned off, so that at least we could easily explain that "if it starts with a %, it's a magic command interpreted by the IPython layer; otherwise it's passed to Python".
If Python grew a similar interpreter layer (which seems like one possible solution here), I think we'd have the same issue of making it easy for users to distinguish "commands" intended for the interactive interpreter from those interpreted by the Python core. I could imagine ending up with users typing "%exit" or "!exit" to exit, but one you're adding an extra sigil to distinguish your commands from plain old references to Python objects it doesn't seem so different from having to type "exit()".
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44603>
_______________________________________
More information about the Python-bugs-list
mailing list