Talin wrote:
> One unresolved issue is what exactly gets assigned to 'x' and 'y' at the
> time the class definition is evaluated.
Seems to me it ought to be some kind of descriptor.
It might be possible to do this reasonably without
any new syntax, e.g.
@cstruct
class MyStruct:
x = cfield("f")
y = cfield("f")
given a function cfield() that returns a suitable
descriptor.
> 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.
--
Greg
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com