Implicit conversion to boolean in if and while statements
gandalf at shopzeus.com
Tue Jul 17 14:43:11 CEST 2012
On 2012-07-17 10:23, Andrew Berg wrote:
> I don't want that, but I am suggesting that it would be consistent with
> the idea of "something or nothing".
Don't confuse names and objects. You can only test the truth value of
objects. If you don't have a name in a namespace, then it means you
don't have a tool to have a reference to anything (including the False
Using the same logic you could also say that not giving any condition to
the "if" statement should be evaluated as False:
print "This never gets executed"
But it makes no sense.
More information about the Python-list