[Python-ideas] print in the interactive interpreter? plus shell API idea
Roman Susi
rnd at onego.ru
Sat Jul 5 17:45:20 CEST 2008
hi!
I am sure that Python interactive interpreter is a good tool.
Before it were simple to print something with print. Now extra ( and )
are needed and also extra caution.
Is it possible to have some simplified "print" in the interactive
interpreter?
IMHO, Basic's "?" is quite a good candidate.
Maybe, it should not even be Python syntax but Python interactive shell
feature.
cf:
>>> print(functools.wraps.__doc__)
and
>>> ? functools.wraps.__doc__
Also, some discussions about http://bugs.python.org/issue449227 (can't
recall where they were, maybe private) indicate that maybe some kind of
Python shell API could be interesting to facilitate Python interpreter's
interaction with shells and provide better, more dynamic, experience to
the shells' users (e.g. readline-like features, inline helps and hints,
etc). With the API it will be easier for "vendors" to come up with
CLUI/GUI/whatever shells. Shells will be thus decoupled from the
interpreter itself. (WSGI is pretty similar in intention to abstract web
service interaction, maybe the one I suggest may be called Rich
Interpreter Shell Gateway Interface (RISGI) or something like that).
The idea is quite raw, maybe not even pre-PEPable yet, because I am not
really shell developer. It also differs from the way Python gets
programmatically embed into something because the interface is really
meant ot be like Python interpreter's "telnet" or "X", for humans. There
could be addons to the shell protocol use (debugger or profiler
subshells, datastructure/class/module browser subshell/subprotocol, help
subshells). Special case shells (using same protocol) may be used, eg,
for mobile phone Python.
To put these topics in two: "standard" Python shell may provide
keystroke shortcuts for some useful cases (like, today's shell is having
underscore to mean most recently calculated expression value). So, "?"
will not be part of the syntax but a shell's shortcut.
I think that such shell protocol is quite unique for the programming
languages and may be real breakthrough in interactive shell field and/or
even whole CLUI.
-Roman
More information about the Python-ideas
mailing list