You cannot define multiple functions with the same name in Python (in the same scope). If you do this, the second definition will be overwritten by the first and will be the only one that is called (at least when both are in the same scope - obviously, you can have class methods in different classes that have a name). The parameter list is also ignored by type, therefore, even if you could define functions twice, the interpreter will distinguish them only by the number of parameters, and not by type. What you need to do is write one function that can process several different lists of arguments, and then, if necessary, check their type inside this function.
The easiest way to do this is to use the default parameters and keyword arguments.
Default options
Say you had a function like this:
def BakePie(crust, filling="apple", oventemp=(375,F), universe=1): ...
You can call this function using the following positional arguments:
BakePie("graham cracker") BakePie("buttery", "cherry") BakePie("fluffy", "lemon meringue", (400,F)) BakePie("fluffy", "key lime", (350,F), 7)
Keyword Arguments
Everything will work, but you cannot always change each by default. What if you want to bake a standard Apple Pie, just in a different universe? Well, you can call it using the keyword arguments:
BakePie("buttery", universe=42)
In this case, the default arguments will be used to fill in and oventemp, and only the argument for the universe (and the cortex, which should always be specified, since there is no default value) will be changed. One rule here is that any keyword arguments must be to the right of any positional arguments when calling the function. The order of the keyword arguments does not matter, for example. this will also work:
BakePie("fluffy", oventemp=(200, C), filling="pecan")
But it will not be:
BakePie(filling="boysenberry", "crumb")
More with keyword arguments
Now, what if the behavior of your function is completely different depending on which arguments are passed? For example, you have a multiplication function that takes either two integers, or takes an integer and a list of integers, or two lists of integers, and multiplies them. This situation is one in which you, the caller, want to use only the keyword arguments. You can configure the function definition as follows:
def GenericMultiply(int1=False, int2=False, ilist1=False, ilist2=False): # check which parameters have values, then do stuff
(Or use None instead of False.)
When you need to multiply two integers, call this:
GenericMultiply(int1=6, int2=7)
NOTE. You can also perform the above with only two positional arguments and manually check their type inside the function, either using the type () function or using try: except: blocks and eg. calling methods that work only on lists or integers for each argument.
additional literature
There are many other ways you could do this in Python, I just tried to describe the simplest one. If you want to know more, I recommend the official section of the Python manual on “Defining Functions” and the next section “More on Defining Functions” (this will lead to a detailed discussion of the positional and keyword arguments, as well as the * args and ** kwargs syntax, which allows you to define functions with variable length parameter lists without the need to use default values).