Antoon Pardon <[email protected]>:
> It is why I have sometime found the need to write:
>
> if flag is True:
>
> Because flag needed to be True, not truthy.
Then, you have found the correct idiom for your rare need. You might
even want to consider:
if flag is UP:
...
elif flag is DOWN:
...
else:
assert flag is HALFMAST
...
I don't particularly like Python's falsey/truthy semantics, but I can
live with it. The biggest problem I have with it is the absence of an
emptiness predicate. I'd like to be able to write:
if not leftover.empty():
...
or even:
if not empty(leftover):
...
rather than having to say:
if not leftover:
...
or:
if len(leftover) > 0: # no, I'd never write this
...
Marko
--
https://mail.python.org/mailman/listinfo/python-list