creating many similar properties

Michele Simionato michele.simionato at gmail.com
Wed Oct 18 04:33:59 EDT 2006


Carl Banks wrote:
> Devil's Advocate: he did say "hidden magic TO YOUR CLASS".
>
> If you use a (real) metaclass, then you have the icky feeling of a
> class permanently tainted by the unclean metaclass (even though the
> metaclass does nothing other than touch the class dict upon creation);
> whereas if you use Michele Simionato's hack, the icky feeling of using
> a stack frame object goes away after the property is created: you are
> left with a clean untainted class.

Yep, exactly.

> Personally, the former doesn't make me feel icky at all.

Please, do this experiment: take all classes defined in the Python
standard library and add
to them a custom do-nothing metaclass. See what happens.


     Michele Simionato




More information about the Python-list mailing list