rlcompleter not calling __getattr__ on [ ]

Fernando Pérez fperez528 at yahoo.com
Tue Apr 23 03:19:38 EDT 2002


holger krekel wrote:

>> Currently ipython seems to do these just fine, after removing the following
>> from the delimiters:
>> 
>> readline_remove_delims -/'"[]{}()
> 
> does
> 
>   b=[]
>   a=a-b.<tab>
> 
> work then? And
> 
>   [[].<tab>
>   
> 
> really works, too?

Well, almost :)

In [2]: b=[]

In [3]: a=a- b.<TAB>
b.__add__           b.__getslice__      b.__ne__            b.count
b.__class__         b.__gt__            b.__new__           b.extend
[snip]

In [3]: [ [].<TAB>
[].__add__           [].__iadd__          [].__setitem__
[].__class__         [].__imul__          [].__setslice__
[].__contains__      [].__init__          [].__str__
[snip]

The trick is the extra spaces before the b. and the []. I know it's cheating, 
but I don't see a straightforward solution to this one right now. I can get 
the a-b.<tab> case to work if I don't remove '-' from the delimiters, but I 
don't want to do that b/c then filenames with - in them don't get completed. 
I'd rather have filename completion and have to put in the occasional extra 
space in an expression. Note though that the characters removed from the 
delimiters are a user setting in ipython, so anyone can change them to their 
taste.

The second case is obviously far trickier :)

Cheers,

f.



More information about the Python-list mailing list