[Python-Dev] RE: Hot-To Guide for Descriptors - Nits! :-)

Guido van Rossum guido at python.org
Wed Jan 21 15:34:46 EST 2004


> François Pinard writes:
> > Would it be more precise to state:
> > "... new style objects or classes (those for which the meta-class is a
> > subtype of `type')"?  Being sub-classed from object or type is just a
> > way, among others, for identifying `type' as the meta-class; but being
> > sub-classed from object is not really required.
> 
> Raymond Hettinger responds:
> > Nope, new-style is taken to mean objects/classes inheriting from
> > object/type.  Meta-class objects are neither new-style nor old-style.
> > While there is room to argue with this arbitrary distinction, it is
> > consistent with Guido's essay and especially relevant to my article
> > because most of the rules don't necessarily apply when meta-classes
> > are used.  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.

Michael Chermside
> Really? I realize the utility of having a term for objects-with-a-
> meta-type-of-type, but I had always understood "new-style" to mean
> things-that-are-not-old-style-classes. I can live with either
> definition, but the Python community should make sure that we use
> the term "new-style class" in a consistent fashion.
> 
> Did everyone else agree with Raymond so François and I are the odd
> men out, or is there a larger confusion over how we use the term?

I'm with Raymond.  Metaclasses that don't derive from 'type' can
create objects that are neither fish nor flesh.

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list