creating many similar properties

Carl Banks pavlovevidence at gmail.com
Wed Oct 18 04:46:21 EDT 2006


Michele Simionato wrote:
> 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.

Do you expect the result to be better or worse than if you applied
stack frame hacks to the whole library?

Come on, I don't think anyone's under the impression we're being
indiscriminate here.


Carl Banks

(BTW, most of the standard library still uses old-style classes.)




More information about the Python-list mailing list