[Python-3000] Metaclasses in Py3K

Thomas Heller theller at ctypes.org
Fri Dec 8 19:37:28 CET 2006

Talin schrieb:
> Guido van Rossum wrote:
>> I've been thinking about this too, and I think it's reasonable to let
>> the metaclass provide the dict to be used as locals. This is easier
>> when the metaclass is given in the class header, e.g. by way of a base
>> class, or through the default metaclass. Although the default default
>> metaclass could of course have a hook to pass things on to another
>> metaclass specified using a __metaclass__ assignment, I'd rather
>> innovate a bit more and add keyword arguments to the class header,
>> e.g.
>> class C(B1, B2, metaclass=Foo):
>>  ...
> Although, I'm not sure a discussion is needed - I think your syntax is 
> fine, better than what we have now, and I have no objection to it.
> Here's a use case example:
>     # Define a C-struct rectangle
>     class Rect(metaclass=ctypes.struct):
>        x = ctypes.int32
>        y = ctypes.int32
>        width = ctypes.int32
>        height = ctypes.int32

Wouldn't it be nice also if functions called with named arguments
were able to reconstruct the order in which arguments were passed?

Having a way to provide the type of dict that will be used as **kw?

(Since I normally dor *not* follow the discussions on this list
I have no idea if this has been discussed already or is in a PEP.)


More information about the Python-3000 mailing list