Unpythonic? Impossible??

Paul Rubin http
Sun Mar 19 18:23:37 EST 2006


Erik Max Francis <max at alcyone.com> writes:
> You can, but a class factory is going to be much clearer and probably
> more maintainable.  From the user's perspective, there's no difference
> from calling a class A to instantiate it, and calling a factory
> function called A that selects the appropriate class and returns an
> instance of it.

I remember having a similar problem involving multiple base classes
and deciding that factory functions couldn't do quite what I wanted.
Here's a thread about it, with a recipe using metaclasses by Roeland
Rengelink:

   http://tinyurl.com/rz6ne

Unfortunately, the subtleties of what I was trying to do now escape
me.



More information about the Python-list mailing list