[IPython-User] Question about object introspection
klo uo
klonuo@gmail....
Sat Sep 22 07:42:42 CDT 2012
I'll try to explain through example:
========================================
In [1]: from lxml import etree
In [2]: tree = etree.fromstring('<foo><bar></bar></foo>')
In [3]: xp = tree.xpath('/foo/bar')
========================================
Now "xp" is a list of objects, in above example list of just one object:
[<Element bar at 0x1aa4aa8>]
So if I want to access variable "xp", I must access list item, and IPython
treats it as a list without exposing underlying object.
As in:
In [4]: xp[0].<tab>
it won't let me inspect the object, while if I type:
In [5]: xp0 = xp[0]
In [6]: xp0.<tab>
Now it exposes the object, and shows me available options/functions.
Why is it like this?
I guess I miss something and there must be some issue with it if it's made
like this, but I can't think of it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120922/468e318d/attachment.html
More information about the IPython-User
mailing list