[Python-ideas] Small nice addition to rlcompleter
taleinat at gmail.com
Wed Jun 25 06:55:20 CEST 2008
Roman Susi wrote:
> I think it could be cool if callable objects were added
> when completed.
Facundo Batista wrote:
> Leonardo Santagada:
> > Why not make a pep about something bigger then? I think python needs a
> > complete interactive interpreter... something that would work right after
> > installing python. I think the language strives to be easy and with a
> > learning curve, this could probably help.
> Note, though, that it's not as easy as it sounds. For example, note
> that the very useful and simple behaviour of doing up-arrow and
> bringing the last line, is not handled by Python code, but by the
> external library readline.
> My point is: you can propose a lot of things (I surely will love
> autocompletion and better block management), but how would you achieve
> that in a multiplatform way?
Which has auto-completion, BTW, and for which I wrote a patch two years ago
which adds () after a completed callable, placing the cursor in between
these parenthesis, and bringing up the callable's call-tip while it's at it
(without obscuring the current line - yay GUI!). The patch was never posted
to the Python issue tracker because I thought there was no interest, but it
would be easy to do so.
(more rambling ahead...)
The annoying bit about my implementation was that I had to use the right
arrow key in order to move past the closing parenthesis. This could be
overcome by just adding the opening '(' as suggested above, or perhaps by
making closing the parenthesis by typing ')' simply "overwrite" the
existing ')' character (with good recognition of when you're just typing a
')' in a string or closing an inner pair of parenthesis, of course).
While I was at it, I also made it complete dict keys (only complete-able
keys like strings and numbers) and auto-magically add  after completed
dicts (with the cursor placed in between), which I found to be surprisingly
useful in interactive work.
P.S. Thanks to Shai Geva for suggesting that I implement the above mentioned
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas