I can not seem to find an answer for this question on the interwebs. In Python, am I able to do something like this:
class MyClass(object):
"""It's my class, yo!"""
def __init__(self, string_of_interest_1):
self.string1 = string_of_interest_1
self.string2 = None
self.int1 = None
def __init__(self, string_of_interest_1, string_of_interest2):
self.string1 = string_of_interest_1
self.string2 = string_of_interest_2
self.int1 = None
def __init__(self, int_of_interest_1):
self.string1 = None
self.string2 = None
self.int1 = int_of_interest_1
I call this "method-overloading", but it seems the standard overloading is when I have some variables that I assign a default value to within the call itself. (E.g., def __init__(self, string_of_interest_1, string_of_interest_2 = None)
) While this tiny example does not demonstrate it, I would like the potential to have truly different methods depending upon how many, and what type, of parameters are passed to it.
Thanks!