Order in metaclass

Nicolas Fleury nid_oizo at yahoo.com_remove_the_
Wed Oct 13 15:59:14 EDT 2004


Thomas Heller wrote:
> In this case, you could also look at the ctypes module, it implements C
> compatible structures and unions.
> 
> And for your original question: why do you insist on your new syntax,
> why don't you simply (as ctypes also does it) define the attributes in a
> list, when they have to have a certain order?

I just looked at ctypes, and yes, that's exactly what I'm doing.  I want 
the structures definitions to be modified by C++ programmers and I find 
the metaclass mechanism much more readable and easy to modify (and it's 
not a lot of code to make everything work).  I agree everything can be 
done using normal Python code, but my goal here is really to make a 
pseudo-language to define our formats, and the pseudo-language is just a 
simpler solution than XML in my specific case.  Probably all cases of 
such using of metaclasses are like that...

Regards,
Nicolas



More information about the Python-list mailing list