Style question (Poll)

Prasad, Ramit ramit.prasad at
Thu Mar 15 00:08:17 CET 2012

> > Only use 'is' if you are looking for objects like True,
> > False, None or something that MUST be exactly the same object.
> I've rarely seen valid uses of 'is True' or 'is False'.

It can be useful when you think something might be None or False. Although,
I suppose you could always just use 'is None' instead.

>>> 1 == True
>>> 1 is True
>>> 0 == False
>>> 0 is False

Granted, the above example is a pretty facetious case; not sure I 
can come up with a reasonably real world use case. 


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at  

More information about the Python-list mailing list