When we type in the interpreter the following:
10(b)
We get a NameError that b is not defined. However, when we try:
10(4)
Now, we get the error message that int is not callable. Why didn't Python give the same error in the first case above, since even there, int was not callable? In other words, in the first snippet, we have both errors of "int not callable" and "NameError". If Python were to scan left to right, it would have first seen the call operation being performed on an int (10). So it should have given the "int not callable" error for the first one too. Why didn't it?
I assumed that this was probably because it evaluates the expression within parenthesis first. However, when we try this:
f(print("Hello"))
Now, it says NameError that f is not defined. It doesn't even print "Hello". So this indicates that our assumption of evaluating parenthesized expressions doesn't seem to hold.
So how exactly does it work?