On Fri, Feb 01, 2019 at 08:26:03AM +0000, João Matos wrote:
> Hello,
> 
> Consider adding the option of running shell/console commands inside the 
> REPL.
> Something like
> >>>!dir

That's a pretty big change, arguably best left for a third-party REPL 
like iPython (which already supports "magic" commands using ! and ? 
syntax).

It is hard to tell precisely where to draw the line between adding 
useful functionality to the standard Python interpreter, and where to 
leave it for "advanced" REPLs or IDEs like iPython.

My personal opinion is that specifically supporting shell commands 
crosses that line, but adding a REPL hook for ! commands which the user 
can customise does not. Hypothetically speaking, the Python interactive 
interpreter, and *only* the interactive interpreter, might define hooks 
for lines starting with a leading ! or ? and users could define their 
own magic functions for those.

Or one could use the code module to define your own custom REPL, and 
automatically run that on startup:

https://docs.python.org/3/library/code.html

Actually, adding a code.InteractiveConsole subclass with hooks for 
lines beginning with ! and ? might be a nice addition to the stdlib 
without adding complexity to the builtin interpreter.



-- 
Steve
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to