[Python-ideas] A better interactive prompt

Nathaniel Smith njs at pobox.com
Tue Oct 25 19:15:07 EDT 2016


On Tue, Oct 25, 2016 at 2:55 PM, Chris Barker <chris.barker at noaa.gov> wrote:
>
>
>> But that's something of a solved problem. IPython offers a rich
>> interactive environment, for people who find the limitations of the
>> standard interactive prompt frustrating. Would it be worth the
>> standard Python documentation promoting IPython for that role?
>
>
> +1 iPython really makes it easier to do exploratory code -- I have my
> students install it day one of an intro to python class.
>
> However, maybe ironically, iPython is still a bit ugly for editing
> multi-line constructs -- maybe it will  get better.

I'm sure it could be improved more, but since the 5.0 release IPython
has been *way* better at editing multi-line constructs than the
built-in REPL is. For example, if I type:

In [1]: def f():
   ...:     return 1
   ...:

In [2]:

and then press up-arrow once, it gives me the complete function body
back and lets me move around and edit it.

Incidentally, PyPy's built-in REPL handles multi-line constructs like
IPython does, rather than like how the CPython built-in REPL does.

There are a lot of logistic issues that would need to be dealt with
before CPython could consider making a third-party REPL the default or
anything like it... it looks like IPython's dependency tree is all
pure-Python, which makes it more viable, but it's still a lot of code
and on a very different development cycle than CPython. bpython
appears to depend on greenlet, which is a whole other issue... OTOH it
seems a little quixotic to spend lots of resources improving the
built-in REPL when there are much better ones with vibrant developer
communities.

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Python-ideas mailing list