[Python-Dev] Re: Hot-To Guide for Descriptors - Nits! :-)
tanzer at swing.co.at
Thu Jan 22 02:31:00 EST 2004
François Pinard <pinard at iro.umontreal.ca> wrote:
> > This is because the machinery for descriptors is embedded in
> > type.__getattribute__ and object.__getattribute__. Override or fail
> > to inherit either of these and all bets are off.
> I thinks I understand better what you are saying. Maybe part of my
> problem is that I'm not sure how `__getattribute__' is itself fetched.
> While I know you do not want to speak about metatypes, it might be
> that whenever you write `type.__getattribute__', you really mean the
> `__getattribute__' found in the dict of the metatype (or is it?);
> while when you write `object.__getattribute__', you really mean the
> `__getattribute__' found by scanning the base classes of the current
> class, and `object' always when there is no base class for a "new-style"
As always, a little experiment at the interactive prompt is
Python 2.3.3 (#1, Dec 21 2003, 09:30:26)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class A :
... __metaclass__ = type
>>> class B :
IMHO, it does make sense to present a simplified view in
introductory documentation, but I also think that there should be
footnotes explaining where white lies are told and giving hints of the
full picture with all the attendant complexity.
Christian Tanzer http://www.c-tanzer.at/
More information about the Python-Dev