rlcompleter not calling __getattr__ on [ ]

Fernando Pérez fperez528 at yahoo.com
Tue Apr 23 02:13:30 EDT 2002


holger krekel wrote:


> great. but i guess we should try to come up with a solution that
> allows
> 
>   a=[[].<tab>
> 
> and similar cases to work. Also
> 
>   a=().<tab>
> 
> should be allowed, too. I'll check that tommorow. Additionally
> i want to see if it is possible to

Currently ipython seems to do these just fine, after removing the following 
from the delimiters:

readline_remove_delims -/'"[]{}()

It completes everything I can see great, and even somewhat weird cases like

a=(4.5).<tab>

vs

a=().<tab>

work fine: the first calls the float methods, the second the tuple ones:


In [1]: r=(4.5).<TAB HERE>
(4.5).__abs__           (4.5).__getattribute__  (4.5).__pos__           
(4.5).__rpow__

[snip...]

In [1]: r=().<TAB HERE>
().__add__           ().__getattribute__  ().__le__            ().__reduce__
().__class__         ().__getitem__       ().__len__           ().__repr__
().__contains__      ().__getslice__      ().__lt__            ().__rmul__

[snip...]

> 
> a) (optionally) just return method names which don't start with '__'

I'm not sure I want to add this option (which would be easy). While true that 
they are often annoying, they also say a lot about the internal structure of 
any given object. I'm afraid of the 'million preferences trap', and I'm 
trying to maintain a reasonable limit on the total number of options 
provided, making 'sound' choices for default behavior.

> 
> b) return to 'readline' strings of the form:
>    
>    COMPLETION "docstring"
> 
>    as this would show you brief documentation for each method.

As I said, ipython's ? and @doc functions already do much of this for me, but 
it may be a nice addition.

Thanks for all the help,

f.



More information about the Python-list mailing list