On Wed, Sep 14, 2011 at 10:20 PM, Matthew Pounsett <matt.pouns...@gmail.com> wrote: > I'm wondering if there's a way in python to cause __init__ to return a class > other than the one initially specified. My use case is that I'd like to have > a superclass that's capable of generating an instance of a random subclass. <snip> > Is there a way to do this?
Override __new__() instead: http://docs.python.org/reference/datamodel.html#object.__new__ Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list