從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