从python 2.x - > python 3.x转换时,我发现内置max
函数的行为发生了这种变化。我没有发现它记录在任何迁移问题的标准位置。 https://eev.ee/blog/2016/07/31/python-faq-how-do-i-port-to-python-3/ http://python-future.org/compatible_idioms.htmlmaxthon()在python2中失败 - >使用`>`不支持python3转换
我该如何解决这个问题?
的Python 2.x的:
In [1]: max([None, None, None])
In [2]:
Python 3.x都有:
In [3]: max([None, None, None])
---------------------------------------------------------------------------
TypeError
Traceback (most recent call last) <ipython-input-3-f82c85b9875c> in <module>()
----> 1 max([None, None, None])
TypeError: '>' not supported between instances of 'NoneType' and 'NoneType'
https://docs.python.org/3.0/whatsnew /3.0.html#ordering-comparisons –
我投票结束这个问题作为题外话,因为它不是一个问题。 – jwodder
我回答了我自己的“问题”(见下文),为了帮助他人,应该明确鼓励这个问题。 – Shankari