[IPython-User] Question about object introspection
Sat Sep 22 07:47:56 CDT 2012
Le 22 sept. 2012 à 14:42, klo uo a écrit :
> I'll try to explain through example:
> In : from lxml import etree
> In : tree = etree.fromstring('<foo><bar></bar></foo>')
> In : 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 : xp.<tab>
> it won't let me inspect the object, while if I type:
> In : xp0 = xp
> In : xp0.<tab>
This is the greedy completer, it is an option, because  can actually be a methods that have side effects…
Introspecting would trigger this methods, like querying over the web, or change the state of an oscilloscope…
So it is disabled by default.
You can opt-in with --IPcompleter.greedy=True
to completer to uppercase().
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-User