Why not 'foo = not f' instead of 'foo = (not f or 1) and 0'?

cokofreedom at gmail.com cokofreedom at gmail.com
Wed Jan 23 04:07:41 EST 2008


Sorry, posted to quickly.

Yes your logic is correct about the "logic" of the return, but theirs
actually differs in what it returns, and I am guessing it is an
important change. Where is this "foo" used? Perhaps its value is used
in a way a boolean return couldn't be?

Just a note, with these kind of points it is often worth just opening
up a python console and printing out the results. Though I do agree
with you, at first look it seems almost redundant to use 1 and 0.
Personally haven't seen this before, rather like it! :)



More information about the Python-list mailing list