Modules providing forward compatibility across Python versions
Project description
Forward compatibility for Python packages, allowing future constructs to be borrowed before they are available in the standard library.
Usage
Import functions from the appropriate compat.pyXX module in your python code. When a package is eventually ready to upgrade beyond pyXX, easily locate (with a grep) and replace those functions with the canonical implementations.
Example
Say you want a namedtuple (introduced in Python 2.6) in a project which supports Python 2.5 and greater:
from compat.py25 import namedtuple MyTuple = namedtuple('MyTuple', 'a b c') mt = MyTuple(1,2,3)
With jaraco.compat installed, this code will run on Python 2.5 and greater. When the project is ready to move to Python 2.6, one can easily grep for py25 and make the necessary replacements with minimal impact on the code. In this case:
from collections import namedtuple MyTuple = namedtuple('MyTuple', 'a b c') mt = MyTuple(1,2,3)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file jaraco_compat-4.2.2.tar.gz
.
File metadata
- Download URL: jaraco_compat-4.2.2.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5380299d2c7f27fac0eaa5550fe569e6919365ebef31f02aa88f26e27d8d5900 |
|
MD5 | dd9139c40636b0376bec3dbecfaaa006 |
|
BLAKE2b-256 | 602d963a836aee200c0407726705a856c08c356e9775b76187274ce2582248a0 |
File details
Details for the file jaraco.compat-4.2.2-py3-none-any.whl
.
File metadata
- Download URL: jaraco.compat-4.2.2-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 323d03a749cb71c0b1485609c7aea30b610514cb86edba44203244c231131175 |
|
MD5 | 9d1fe2c2583a3d29465991b401e75aa6 |
|
BLAKE2b-256 | 477f7035ef640c0ff7bf0c405292dc8a1b2ba88b2823187fdbb173d68c8e9ebd |