Oct. 11, 2021
11:36 a.m.
On 10/10/2021 13:31, Steven D'Aprano wrote:
On Sat, Oct 09, 2021 at 08:16:58PM -0600, Finn Mason wrote:
import sys if sys.version_info < (3, 6): # Yell at the user Please, version checking is usually an anti-pattern! You should use feature detection whenever possible, not version checking.
Understood. But would you agree that if you are writing code to be Python 2- and Python 3-compatible, it is reasonable to check the major version: Python3 = sys.version_info.major >= 3 .... if Python3: # this code used to work without this bit ... if not Python3: # can't use this feature etc. Best wishes Rob Cliffe