On 07/12/2010 06:36 PM, Paul Rubin wrote: > I'd personally prefer > > if not bool(myValue): > > which would call the myValue's __bool__ method if it chose to implement > one. Explicit is better than implicit.
That's just ugly. Probably a more explicit way would be to have an is_true() and is_false() function/method. if is_false(my_value). But that's ugly too, especially when the idea of emptiness or falseness is so consistently defined across python types. I have yet to encounter any situation where I got tripped up on such a small thing as the OP. -- http://mail.python.org/mailman/listinfo/python-list