Method overloading?

placid Bulkan at gmail.com
Wed Feb 14 23:54:31 EST 2007


Hi all,

Is it possible to be able to do the following in Python?

class Test:
    def __init__(self):
        pass

    def puts(self, str):
        print str

    def puts(self, str,str2):
        print str,str2

if __name__ == "__main__":
    t = Test()
    t.puts("hi")
    t.puts("hi","hello")


Cheers




More information about the Python-list mailing list