[Python-Dev] Re: [PEP 224] Attribute Docstrings

Fredrik Lundh effbot at telia.com
Thu Aug 31 18:10:38 EDT 2000


huaiyu zhu wrote:
> Mabe I'm dense, too, but why should the answers to these questions (whatever
> they might be) be different between D.__doc_y__ and D.__docs__['y']?

D.__doc_y__ uses the standard attribute search mechanism;
if the attribute isn't defined in the given class, Python will look
for it in the base class(es).  in other words, dot notation and
"getattr" just works...

if __docs__ is an ordinary dictionary (as proposed), that won't
happen.

:::

you can of course get around this by using a custom dictionary-
like type (and get gc problems and code bloat for free), or add
a new built-in which works like getattr, but looks in __docs__ in-
stead of __dict__.

</F>

<!-- daily news from the python universe:
http://www.pythonware.com/daily/index.htm
-->




More information about the Python-list mailing list