Skip to main content

Python version based conditionals

Project description

You can install the library with pip:

pip install nxpy-past

Nxpy Past provides ways to express conditions on the current Python version to help handling version differences:

import nxpy.core.past

if nxpy.core.past.V_2_6.at_least():
    import abc
else:
    class abc(object):
        class ABCMeta(type):
            def __new__(mcs, name, bases, dict):
                return type.__new__(mcs, name, bases, dict)

It is also possible to express assertions on the current version to better document why some code fails:

import nxpy.core.past

nxpy.core.past.enforce_at_least(nxpy.core.past.V_2_6)

The library’s documentation is available on ReadTheDocs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for nxpy-past, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size nxpy_past-1.0.1-py2.py3-none-any.whl (4.4 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size nxpy_past-1.0.1.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page