I am trying to build a complex number calculator in python. The number will be represented by a class with two fields. The first constructor I want to use looks like this:
def __init__(self,real,imag):
self.real = real
self.imag = imag
but i would like to use another, where the only parameter will be a string representing the whole number:
def __init__(self,string_number):
How to implement the overload that allows to use different number of parameters? I am more used to C++, where such thing was easy. Thanks a lot!
EDIT: Question marked as duplicate: I did not find any answer regarding different number of parameters. The error I get when trying to build a new instance of the class is about to few arguments.