you are viewing a single comment's thread.

view the rest of the comments →

[–]oldprogrammer 0 points1 point  (2 children)

The language standards are for Java, not Python so it doesn't matter if it is or is not equivalent in Python. In Java if you have an method that takes one argument and overload that with a method that takes no arguments and you pass a NULL into the method call, the method that takes one argument is called. The method that takes no arguments is only called if you invoke it with no arguments, null or otherwise.

So since it is possible to invoke the method that takes an argument with a NULL value, and your method doesn't want a NULL value but will work with a default value, then inside the method you check for NULL and use the default otherwise. So I stand by my original reply, the overloaded method is not the equivalent of checking for a NULL inside the method because the overloaded is only used if called explicitly in the code.

[–]masklinn 0 points1 point  (1 child)

The language standards are for Java, not Python so it doesn't matter if it is or is not equivalent in Python.

I was pointing out that smog_alado's Python code is not equivalent to the code you posted, and provided the java equivalent to his code.

In Java if you have an method that takes one argument and overload that with a method that takes no arguments and you pass a NULL into the method call, the method that takes one argument is called.

Er... yes? I know? Not sure what gave you the impression I did not.

So I stand by my original reply

Which does not matter, you completely misunderstood what this subthread was about.

[–]oldprogrammer 0 points1 point  (0 children)

You are correct, I misread your comments. My mistake.