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" > class. As always, a little experiment at the interactive prompt is instructive: 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 ... >>> A <class '__main__.A'> >>> A.__bases__ (<type 'object'>,) >>> class B : ... pass ... >>> B.__bases__ () 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/
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