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

后端 未结 3 1502
爱一瞬间的悲伤
爱一瞬间的悲伤 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:47

    Unless you have a very specific reason to support Python 2.x, then Python 3.x is the future. It's been over 10 years since it was released.

    Python 2.7, the last of the 2.x series, is end of life'd in 2020. https://www.python.org/dev/peps/pep-0373/

    TLDR: It's time to use Python 3

提交回复
热议问题