[Python-Dev] Re: Hot-To Guide for Descriptors (original) (raw)
Christian Tanzer tanzer at swing.co.at
Thu Jan 22 02:31:00 EST 2004
- Previous message: [Python-Dev] Re: Hot-To Guide for Descriptors - Nits! :-)
- Next message: [Python-Dev] Re: Hot-To Guide for Descriptors - Nits! :-)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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/
- Previous message: [Python-Dev] Re: Hot-To Guide for Descriptors - Nits! :-)
- Next message: [Python-Dev] Re: Hot-To Guide for Descriptors - Nits! :-)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]