首页 > 编程语言 > 详细

Python None comparison: should I use “is” or ==?

时间:2016-12-27 14:09:59      阅读:251      评论:0      收藏:0      [点我收藏+]

Use is when you want to check against an object‘s identity (e.g. checking to see if var is None). Use == when you want to check equality (e.g. Is var equal to 3?).

 

 

ref: http://stackoverflow.com/questions/14247373/python-none-comparison-should-i-use-is-or

Python None comparison: should I use “is” or ==?

原文:http://www.cnblogs.com/pinganzi/p/6225431.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!