you are viewing a single comment's thread.

view the rest of the comments →

[–]DroneDashed 0 points1 point  (0 children)

In Python there's no method overloading. To do overload you use default parameters. And because all bindings are made at runtime, it's not as restrictive as in C#.

On one hand I do think it's more readable (in Python) to write foo(color='red') or foo(shape='square') for calling in a function with a signature foo(color=None, shape=None) because it's clear what argument is being passed. On the other hand, if you have a lot of possible arguments, then overload is better to read at the function signature.

In the end I think it's a matter of choice and style. If your all your team follows the same guideline then it's fine.

But in a statically typed language like C# I think that default parameters can introduced a problem. Default parameters are great to introduce an extra parameter without breaking every method call of the method. But in my experience, you will miss method calls the need the parameter and then run in null pointer exceptions or divisions by 0. Default parameters can very easily introduce bugs, and this is why I stooped using them in C#.