Python: False vs 0

后端 未结 3 1976
傲寒
傲寒 2020-11-30 13:13

In PHP you use the === notation to test for TRUE or FALSE distinct from 1 or 0.

For example i

3条回答
  •  醉梦人生
    2020-11-30 13:40

    if something is False:
    

    is what you should do

    if something is None:
    

    also works

    the moral is use is ... (although you should never do something is 123457, or simillar)

    for why you should never do this with ints and things see http://ideone.com/iKmWCn

提交回复
热议问题