Overloaded Constructor

paralizer at my-deja.com paralizer at my-deja.com
Wed Oct 18 03:21:06 EDT 2000


How can I use overloaded constructor in Python?
Such as

class myClass:
    def __init__(self):
        dosomething()
    def __init__(self,any_var1,any_var2):
        dosomething_with_any_varx()

and when i use

    d = myClass # means i use the first constructor
    e = myClass(yyy,zzz) # means i use the second one

any suggestion?


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list