On Wed, Aug 8, 2012 at 9:59 AM, Oleg Broytman <phd@phdru.name> wrote:
On Thu, Aug 09, 2012 at 02:18:53AM +1000, Ben Finney <ben+python@benfinney.id.au> wrote:
> What is a compelling use case for checking precisely for True or False?

   To distinguish False and None for a tri-state variable that can have
3 values - "yes", "no" and "unspecified" - True, False and None in

I'd probably write that this way:

    if t is None:
        # not specified
    elif t:
        # true
        # false

on the other hand, if I had a variable that could be either a number or True/False, I would probably write:

    if t is True:
    elif t is False:
        # use t as a number

just as I would for any other singleton value. Why does the PEP say that == True is preferred to is True?

--- Bruce
Follow me: http://www.twitter.com/Vroo http://www.vroospeak.com