[Python-3000] Generic function PEP won't make it in time

Phillip J. Eby pje at telecommunity.com
Thu Apr 26 17:30:23 CEST 2007

At 06:33 AM 4/26/2007 -0700, BJörn Lindqvist wrote:
>On 4/22/07, Phillip J. Eby <pje at telecommunity.com> wrote:
> > I got off to a good start in terms of figuring out what needs to be in the
> > PEP...  good enough to realize that a complete specification of what I have
> > in mind is probably going to dwarf the WSGI spec.  There are just too many
> > details that have to be explained; the roughly 1000 lines of Python code I
> > have in mind is translating to quite a *lot* more words of English, to
> > explain intentions, ramifications, etc.
>"If the implementation is hard to explain, it's a bad idea."

The implementation is *easy* to explain.  Here's an equally easy 
explanation of the new-style type hierarchy:

'type' is a subclass of 'object'.  'object' is an instance of 
'type'.  'type' is an instance of 'type'.  The method resolution order 
(mro) of a type is a sequence such that the types bases appear in the same 
relative order in the mro as they do in the bases list, and such that the 
types in the mros of the bases maintain the same relative order in the 
subclass' mro as they do in that base's mro.  If no such sequence can be 
constructed, the type is invalid.

Short, sweet, and beautiful in its simplicity.  It's the *rationale* and 
*consequences* that take a lot of explaining, not the implementation.

In the case of the explanation above for new-style types, the rationale and 
consequences fill most of a book: the "Putting Metaclasses to Work" book 
that Guido used as inspiration.

More information about the Python-3000 mailing list