tabs and the Python3 console

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Feb 10 18:25:12 EST 2015


Laura Creighton wrote:

> I have the debian version of python3 installed here.
> 
> Python 3.4.2 (default, Nov 13 2014, 07:01:52)
> [GCC 4.9.2] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> 
> 
> But I cannot seem to type a tab here:
> 
>>>> def fn(**kw):
> ...
> 
> (I type a tab here, and get a beep.  If I type a tab again I get:
> 
> Display all 178 possibilities? (y or n)
> ArithmeticError(            chr(
> AssertionError(             class
> AttributeError(             classmethod(
> BaseException(              compile(
> BlockingIOError(            complex(
> BrokenPipeError(            continue
> <lots more skipped, because you get the idea>
> ...
> 
> Do I need a python3 enabled with readline support, or something?


The good news is that after many, many years of supporting tab completion,
Python 3.4 finally enables it by default.

The bad news is that its handling of the tab key is fundamentally broken.

There are a couple of tasks on the bug tracker dealing with this. I'm not
able to search for them right now, but you may be able to find them: there
is a task to enable tab completion by default, which I expect is closed by
now, and (if memory serves me correctly) a second, open, task to fix the
tab-for-indentation issue.

As an alternative, you could try my tab completion and history module:

http://code.google.com/p/tabhistory/

I've been using it on Linux for about three or four years, and although I
don't promise it is bug-free, it shouldn't blow up your computer :-)

You can read an announcement here:

http://code.activestate.com/lists/python-list/672898/

Feedback from Mac and Windows users is very, very welcome.



-- 
Steven




More information about the Python-list mailing list