[wingide-users] Support for _getAttributeNames in auto completion choices

Wingware Support support at wingware.com
Thu Apr 2 08:50:35 MDT 2009


Matthew Scott wrote:
> Some packages rely on the use of dynamic attributes using the 
> __getattr__ protocol.  That is, they don't appear in the object's 
> attributes when using dir(), but they are generated on the fly when 
> requested.
> 
> There is a de facto API called _getAttributeNames for providing such 
> names to tools for autocompletion when the names of those dynamic 
> attributes are 
> available: http://mail.python.org/pipermail/python-list/2001-August/100603.html
> 
> It was originally introduced by PyCrust.  Since then, I know that at 
> least IPython uses this protocol.  Some projects that make use of this 
> API can be seen 
> here: http://www.google.com/codesearch?hl=en&sa=N&q=_getAttributeNames++lang:python&ct=rr&cs_r=lang:python 
> <http://www.google.com/codesearch?hl=en&sa=N&q=_getAttributeNames++lang:python&ct=rr&cs_r=lang:python>
> 
> I noticed that WingIDE 3.2 beta does not support this API, at least in 
> the built-in Python shell that I was familiarizing myself with.
> 
> Could support for this be added into WingIDE 3.2?

We could try to call this when doing live data introspection, but there's
no good way to use it for static analysis unless most of them are something
simple like returning a canned list.  A few in the second link above do
that but many are more complex and wouldn't yield to static analysis.

I did add this to our source base for 3.2 since it's easy to do at runtime.
However, even in live introspection we try to avoid calling methods since they can
have unwanted side effects so the feature is disabled unless you turn on the
Debugger / Advanced / Allow Dynamic Introspection preference.

-- 

Stephan Deibel
Wingware | Python IDE
Advancing Software Development

www.wingware.com



More information about the wingide-users mailing list