Is this a good use of __metaclass__?
Terry Reedy
tjreedy at udel.edu
Fri May 5 14:02:09 EDT 2006
"Joel Hedlund" <joel.hedlund at gmail.com> wrote in message
news:e3f96d$3oi$1 at news.lysator.liu.se...
> Below, you'll find some background info and an executable code example.
>
> In the code example I have two ways of doing the same thing. The problem
> is
> that the "Neat" version doesn't work, and the "Ugly" version that works
> gives
> me the creeps.
To me, your Ugly version is easier to read and understand than the
so-called Neat version. You change an attribute of a class to change its
behavior without changing its identity. I can imagine ways to hide this,
but I would leave it simple and explicit.
Terry Jan Reedy
More information about the Python-list
mailing list