[Python-Dev] Re: PEP 318: Can't we all just get along?

Bob Ippolito bob at redivi.com
Thu Aug 19 22:55:04 CEST 2004


On Aug 19, 2004, at 4:09 PM, Jp Calderone wrote:

> Bob Ippolito wrote:
>> class Foo(object):
>>     __metaclass__ = Bar
>>     ...
>> is *much* different than
>> class Foo(object):
>>     ...
>> Foo = barEquivalentFunction(Foo)
>> which is the same as
>> @barEquivalentFunction
>> class Foo(object):
>>     ...
>
>   Only if you choose to write it such that it is different.  Either 
> can result in effects that persist down the inheritence tree, and 
> either can result in effects that do not.

Of course, but my point is that it's default behavior for the "Bar" 
metaclass to become part of the inheritance graph, where default 
behavior for "barEquivalentFunction" wouldn't ever do such a thing.  
Actually, aside from returning a different class object altogether, the 
only thing I can imagine "barEquivalentFunction" doing that would 
affect the inheritance graph is to mutate __bases__, which is just 
crazy.

-bob


More information about the Python-Dev mailing list