Skip to content
This repository was archived by the owner on Feb 4, 2024. It is now read-only.
This repository was archived by the owner on Feb 4, 2024. It is now read-only.

version_info.major >= 3 and version_info.minor >= 5 #8

Closed
@hugovk

Description

@hugovk

This is used in three places in scipy, and I've seen this sort of thing in other repos too:

if sys.version_info.major >= 3 and sys.version_info.minor >= 5:
    from math import gcd
else:
    from fractions import gcd

The if is incorrectly False for 4.0 - 4.4, 5.0 - 5.4, etc.

To fix:

-if sys.version_info.major >= 3 and sys.version_info.minor >= 5:
+if sys.version_info >= (3, 5):
     from math import gcd
 else:
     from fractions import gcd

Can this easily be detected?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions