Can somebody explain this tricky output:
>>> not(type(1.01)) == type(1) # Why does the expression evaluates to True!?
True
>>> not(type(1.01))
False
>>> False == type(1)
False
What happens there? And why this happens?
Answer:
When I asked question I treated not
as a function, but actually not
isn't a function. That's why not(#something) doesn't change operator precedence. For example:
not(type(1.01)) == type(1)
is the same as:
not(type(1.01) == type(1))
and:
not type(1.01) == type(1)
but not the same as:
(not type(1.01)) == type(1)