Skip to main content

More future! Make Python 2/3 compatibility a bit easier

Project description

mo-future

More future! Make Python 2/3 compatibility a little bit easier

Problem

future or six are hard to use: It is easy to google how to import an object in Python2, or Python3, but finding the full path in these compatibility libraries is difficult.

Solution

All the modules and types required for compatibility are put into the mo-future top-level module so they are easy to find.

Flat namespace

Instead of

    from future.utils import text_type

you get the same, but without having to discover what sub-module the text_type is hiding:

    from mo_future import text_type

Simpler imports

Instead of writing conditional imports like

    try:
        from io import StringIO
    except:
        from StringIO import StringIO

or

    if PY3:
        from io import StringIO
    else:
        from StringIO import StringIO

you can use mo-future:

    from mo_future import StringIO

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
mo-future-2.20.18317.tar.gz (3.7 kB) Copy SHA256 hash SHA256 Source None

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 SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page