[Python-Dev] Requesting that a class be a new-style class
Phillip J. Eby
pje at telecommunity.com
Sun Feb 20 18:15:44 CET 2005
At 09:15 AM 2/20/05 +0100, Alex Martelli wrote:
>This is because types.ClassType turns somersaults to enable this: in this
>latter construct, Python's mechanisms determine ClassType as the metaclass
>(it's the metaclass of the first base class), but then ClassType in turn
>sniffs around for another metaclass to delegate to, among the supplied
>bases, and having found one washes its hands of the whole business;-).
To be pedantic, the actual algorithm in 2.2+ has nothing to do with the
first base class; that's the pre-2.2 algorithm. The 2.2 algorithm looks
for the most-derived metaclass of the base classes, and simply ignores
classic bases altogether.
More information about the Python-Dev
mailing list