meta None?

Moshe Zadka moshez at math.huji.ac.il
Mon Aug 21 06:59:47 EDT 2000


On Mon, 21 Aug 2000, Tripp Lilley wrote:

> I guess it's not so much that *I* care to use is... I mean, the test:
> 
> 	if o.value == None:
> 
> works just as well, right?

For what? For testing "is it really really None, and I want the answer
yesterday!", if o.value is None: is the preferred way. For testing
"does this object think it is None, and take your time", if o.value ==
None: is the preferred way. I usually use the "is" form, since it
gurantees me that no magic will happen.






More information about the Python-list mailing list