为什么没有< = 0 [英] Why is None <= 0

查看:116
本文介绍了为什么没有< = 0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



>>无< = 0
>>None <= 0



True


为什么?

有合理的原因吗?


Gregor

True

Why?
Is there a logical reason?

Gregor

推荐答案

2008年4月25日星期五20:27:15 +0200

Gregor Horvath< gh@gregor-horvath.comwrote:
On Fri, 25 Apr 2008 20:27:15 +0200
Gregor Horvath <gh@gregor-horvath.comwrote:

> >无< = 0
>>None <= 0



真实


为什么?

True

Why?



为什么不呢?

Why not?


有合理的原因吗?
Is there a logical reason?



Python中的所有内容都可以与其他所有内容进行比较。这取决于

程序员确保他们正在比较合理的事情。


-

D''Arcy JM Cain< da *** @ druid.net |民主是三只狼
http://www.druid.net/darcy/ |和一只羊投票

+1 416 425 1212(mod#0082)(eNTP)|什么是晚餐。

Everything in Python can compare to everything else. It is up to the
programmer to make sure that they are comparing reasonable things.

--
D''Arcy J.M. Cain <da***@druid.net | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what''s for dinner.


Gregor Horvath写道:
Gregor Horvath wrote:

>>无< = 0
>>None <= 0



True

True



更准确:

More accurately:


>>无< 0
>>None < 0



True

True


为什么?

有合理的原因吗?
Why?
Is there a logical reason?



无小于除了它自己以外的一切:

None is "less than" everything except for itself:


>>无< ''a''
>>None < ''a''



True

True


>>无<假
>>None < False



True

True


>>无==无
>>None == None



True


在我的拙见中,我认为涉及无的比较应该返回无,但我相信设计师想出这个非常好的原因。据我所知,我从来没有被它咬过。


Paul

True

In my humble opinion, I think that comparisons involving None should
return None, but I trust that the designers came up with this for very
good reasons. As far as I know I''ve never been bitten by it.

Paul


D''Arcy JM Cain schrieb :
D''Arcy J.M. Cain schrieb:

周五,2008年4月25日20:27:15 +0200

Gregor Horvath< gh@gregor-horvath.comwrote:
On Fri, 25 Apr 2008 20:27:15 +0200
Gregor Horvath <gh@gregor-horvath.comwrote:

> >>无< = 0
> >>None <= 0


正确

为什么?

True

Why?



为什么不呢?


Why not?



因为,来自 http://www.python.org/dev/peps/pep-0020/


错误永远不会无声通过。

面对歧义,拒绝猜测的诱惑。


格雷格

Because, from http://www.python.org/dev/peps/pep-0020/ :

Errors should never pass silently.
In the face of ambiguity, refuse the temptation to guess.

Greg


这篇关于为什么没有&lt; = 0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆