No overloading in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

No overloading in python

I know there's no overloading methods in python. what's the best way to work around this? have different code paths testing explicitly for current data type combinations?

15th Nov 2016, 11:51 PM
Guy
Guy - avatar
1 Answer
0
imo there's no need to overload functions in Python. Arguments haven't got any type, so you "believe", that input will be correct. By the way if you really want,you can check if object passed through parameter inside your method.
16th Nov 2016, 1:16 AM
Jakub Stasiak
Jakub Stasiak - avatar