PyCrust autocompletion of objects in sequences?

I've just switched from IPython to PyCrust as a Matlab-like environment, and after some fiddling with the code to customize it, I'm in love :slight_smile:

I've noticed though that PyCrust won't bring up an autocompletion menu for an object stored in a sequence:

>>> o = object()
>>> o. # this brings up an autocompletion menu
>>> l = [object()]
>>> l[0]. # this doesn't

The same holds for objects in tuples and dictionaries. Does this have something to do with safely eval'ing code fragments? According to Fernando Perez, IPython has a similar limitation for safety, although it only seems to be with unbound strings and dictionaries, and not lists (I think).

Can anyone provide an explanation/example for this behaviour? I suppose I could just do a dir() on the object in the sequence, but I'm lazy. Also, the PyCrust namepsace tree doesn't have this limitation.

More to the point, can anyone point me in the right direction on what would need to be done in the PyCrust code to enable autocompletion menus of objects in sequences? I have a data structure with lots of nested objects, stored in sequences (mostly dictionaries) whose attributes I'd rather not have to rack my brain (or my fingers) for, even if it were to create problems in some situations.

Cheers,

Martin

Ed Leafe wrote:

···

On Jun 10, 2006, at 9:19 AM, Martin Spacek wrote:

Now, objects in lists, dictionaries, and tuples will autocomplete, as will unbound objects:

>>> l = [object()]
>>> l[0]. # this pops up an autocompletion menu
>>> d = {'key': object()}
>>> d['key']. # this pops up an autocompletion menu
>>> t = (object(),)
>>> t[0]. # this pops up an autocompletion menu
>>> object(). # this pops up an autocompletion menu

I haven't tested this much, I don't understand the code very well, and I have no idea what kind of unintended consequences the changes might have. Can anyone enlighten?

    That works, but now if I type something like:

test=self.

... I don't get autocompletion popping up anymore.

Bummer. I guess I'll have to revert that change in CVS HEAD...

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!