Why doesn't Python support function overloading?

Knowing the question: Why does Python not support function overloading?

Function overloading is mainly to solve two problems.

Okay, so for case 1, the function has the same function, but the parameter type is different, how does python handle it? The answer is that there is no need to deal with it at all, because python can accept any type of parameter. If the function of the function is the same, then different parameter types are likely to be the same code in python, and there is no need to make two different functions.

So for case 2, the function has the same function, but the number of parameters is different, how does python handle it? As you all know, the answer is the default parameters. The problem can be solved by setting the missing parameters as default parameters. Because you assume that the functions are the same, the missing parameters will eventually be needed.

Well, given that both cases 1 and 2 have solutions, python naturally does not need function overloading.

Recommended Posts

Why doesn't Python support function overloading?
Why doesn't Python support the switch statement?
Why doesn't Python support the switch statement?
Why doesn't Python support the switch statement?
Is there function overloading in python
Why Python -m
Python enumerate() function
Python function buffer
Why python is popular
Python custom function basics
Join function in Python
Python built-in function -compile()
Python function basic learning
Python data analysis-apply function
Python3 built-in function table.md
Python Print print timer function
Python defines a function method
Python realizes online translation function
Python tornado upload file function
Python magic function eval () learning
Does Python support multiple inheritance?
How Python implements FTP function
Python implements image stitching function
Python high-order function usage summary!