It looks like we have to compare both strings in the if statements.
I have a question. it is true that I can have functions with the same name but that they have a different parameter in the ().
For example
def the_function():
some statement
def the_function(name):
#some statement
these functions have the same name but they are different for the compiler true ?? this methodology is called
overloaded (In java this thing is possible if I remember well)
tranks for your answer
Function overloading involves having one function that has no parameters, and one function that takes an object. If they have the same name, the interpreter/compiler will choose based on parameter.
tranks for your answer
Function overloading is a thing but Iām not aware of such an option being possible in Python.
Had to nose into it as Iām sure Iāve come across pythonic solutions to this before, other than just trying to squeeze in different chunks of code based on conditionals. Turns out thereās quite a few options so for anyone who really wants to mimic function overloading thereās plenty of discussion at-
Looks to me like a bit of a hack.
A āmickey mouseā solution.
Lets āfix it with duct tapeā to make it work cuz we canāt figure out any other way right now.
IMHO.