opensubscriber
   Find in this group all groups
 
Unknown more information…

p : python-list@python.org 6 November 2009 • 9:20PM -0500

is None or == None ?
by mk

REPLY TO AUTHOR
 
REPLY TO GROUP






Hello,

Some claim that one should test for None using:

if x is None:

..but the standard equality which is theoretically safer works as well:

if x == None:

So, which one is recommended?

Can there be two None objects in interpreter's memory? Is testing for
identity of some variable with None safe? Does language guarantee that?
Or is it just property of implementation?

Regards,
mk

--
http://mail.python.org/mailman/listinfo/python-list

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.