码迷,mamicode.com
首页 > 编程语言 > 详细

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

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

标签:should   iso   stack   bsp   nbsp   http   var   ack   object   

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 ==?

标签:should   iso   stack   bsp   nbsp   http   var   ack   object   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!