cause __init__ to return a different class?

Miki Tebeka miki.tebeka at gmail.com
Thu Sep 15 18:37:44 CEST 2011


I'd go for a factory function (http://en.wikipedia.org/wiki/Factory_method_pattern):

def create(foo):
    return Child(foo) if foo else Parent()



More information about the Python-list mailing list