> Brad Harms FearsomeDragonfly at gmail.com > Mon Nov 30 05:04:37 CET 2009 > > That was a relatively simple example; classes as simple as the ones > generated by the It is more likely that the class generation could would > appear in a metaclass's class constructor or decorator function, and there > would be more than just the three attributes given.
Bwa ha ha! Well, I managed to screw up that paragraph pretty badly. (I code better than I write, honest.) Let me try again: That was a relatively simple example; classes as simple as the ones generated by the factory function example given are not needed very often. It is more likely that the class generation would appear in a metaclass's class constructor or decorator function, and there would be more than just the three attributes. That way it could be possible to ADD those properties and methods to a class in the process of being built rather than make a class with just those attributes. Lie Ryan, I think I see what you're saying about using __dict__ to add members to a class, but it's not quite the same. __dict__ is only for attributes, NOT properties, methods, etc. which all come from the class of an object rather than the object's __dict__. Adding things to __dict__ would only work halfway; it wouldn't be very extensible. That's (one of the reasons) why the members have to be accessed as attributes rather than dict items. -- http://mail.python.org/mailman/listinfo/python-list