Hello,
here is a small basic question :
Is it possible to have more than one constructor (__init__ function) in a
class? For instance, to create an object with 2 different ways? If my
memory is good, I think that with C++ it is possible.
Thanks for your answer.
--
http://mail.python.org/mailman/listinfo/python-list
here is a small basic question :
Is it possible to have more than one constructor (__init__ function) in a
class? For instance, to create an object with 2 different ways? If my
memory is good, I think that with C++ it is possible.
Thanks for your answer.
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
You have to use default values in __init__ function, like :
def __init__( self, name = None ):
self.name_ = name
and afterwards in your code, test variable :
if self.name_:
do something...
Regards,
Phil.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130814/74c8f152/attachment.html>
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130814/74c8f152/attachment.html>