Is it preferable to use __future__ or future to write code compatible with python2 and python3?

后端 未结 3 1584
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-25 15:06

Or are there specific situations where one is better than the other?

So far, all I gathered is that future is only available for >=2.6 or >=3.3.

The current code

3条回答
  •  情深已故
    2021-01-25 15:52

    Python 2.7 will not be maintained past 2020, see https://pythonclock.org/

    Thus, if you just started learning python, I would suggest you just use python 3 directly instead of using python 2 and importing __future__.

提交回复
热议问题