On Sun, Nov 21, 2010 at 1:07 AM, michael.foord <python-checkins at python.org> wrote: > +Fetching attributes statically > +------------------------------ > + > +Both :func:`getattr` and :func:`hasattr` can trigger code execution when > +fetching or checking for the existence of attributes. Descriptors, like > +properties, will be invoked and :meth:`__getattr__` and :meth:`__getattribute__` > +may be called. > + > +For cases where you want passive introspection, like documentation tools, this > +can be inconvenient. `getattr_static` has the same signature as :func:`getattr` > +but avoids executing code when it fetches attributes. This description feels a little strong to me - getattr_static still executes all those things on the metaclass as it retrieves the information it needs to do the "static" lookup. Leaving this original description (which assumes metaclass=type) alone and adding a note near the end of the section to say that metaclass code is still executed might be an improvement. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4