newbie-question: more then one constructor in a python-class?

Emile van Sebille emile at fenx.com
Sun Jul 7 12:00:16 EDT 2002


T. Kaufmann
> is there a way to have more (then one) constructors in a python-class
(like in Java)?


One common way is to use keyword arguments:

class Test:
    def __init__(self, arg1=None, arg2=None, arg3=None):
        # do stuff based on the args passed

--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list