Equivalent to C bitmasks and enumerations

Ulrich Eckhardt eckhardt at satorlaser.com
Mon Apr 20 09:49:16 CEST 2009


Ulrich Eckhardt wrote:
[how to handle bitfields and enumerations in Python]

Thanks to all that answered. The important lessons I learned:
 * You can modify classes, other than in C++ where they are statically
defined. This allows e.g. adding constants.
 * __repr__ should provide output suitable as input to the Python
interpreter if possible.

Very interesting!

Uli

-- 
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932




More information about the Python-list mailing list