Thanks a lot for the reply. But I want to do something like this class BaseClass: def __init__(self): # Some code over here def __init__(self, a, b): # Some code over here def __init__(self, a, b, c): # some code here
baseclass1=BaseClass() baseclass2=BaseClass(2,3) baseclass3=BaseClass(4,5,3) regards prasad chandrasekaran --- Cancer cures smoking -----Original Message----- From: Larry Bates [mailto:[EMAIL PROTECTED] Sent: Friday, September 30, 2005 7:39 PM To: Iyer, Prasad C Subject: Re: Overloading __init__ & Function overloading I may be reading this question different than Fredrik. This example is with old-style classes. class baseclass: def __init__(self, arg): # # Do some initialization # def method1(self, arg): # # baseclass method goes here # class myclass(baseclass): def __init__(self, arg): # # This method gets called when I instantiate this class. # If I want to call the baseclass.__init__ method I must # do it myself. # baseclass.__init__(arg) def method1(self, arg): # # This method would replace method1 in the baseclass # in this instance of the class. # myObj=myclass(arg) I could be way off base, but maybe it will help. -Larry Bates Iyer, Prasad C wrote: > I am new to python. > > I have few questions > a. Is there something like function overloading in python? > b. Can I overload __init__ method > > Thanks in advance > > > > regards > prasad chandrasekaran > > > > > > > > > > > > > > > > > > > > > --- Cancer cures smoking > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of [EMAIL PROTECTED] > Sent: Friday, September 30, 2005 6:36 PM > To: python-list@python.org > Subject: Python-list Digest, Vol 24, Issue 455 > > Send Python-list mailing list submissions to > python-list@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/python-list > or, via email, send a message with subject or body 'help' to > [EMAIL PROTECTED] > > You can reach the person managing the list at > [EMAIL PROTECTED] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Python-list digest..." > > This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. > This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. -- http://mail.python.org/mailman/listinfo/python-list