[Python-3000] Class Decorators + ctypes (Was: yes to class decorators)

Talin talin at acm.org
Fri Nov 17 10:00:46 CET 2006


Greg Ewing wrote:
> Talin wrote:
>> A different approach would be to say that the class decorator can 
>> overload the '__setattr__' method on the class itself during class 
>> creation:
> 
> But it doesn't work that way -- class attributes don't
> go through __setattr__ during class creation. They go
> into a dict that is passed to the type object's
> constructor. The class doesn't even exist while the
> class body is being evaluated.

I see that as a shortcoming of the current metaclass implementation. It 
would be much more useful IMHO if the the metaclass had access to the 
declaration order. Perhaps the class decorator protocol could somehow 
take this into account?

-- Talin


More information about the Python-3000 mailing list