Skip to content

More future! Make Python compatibility a little bit easier

License

Notifications You must be signed in to change notification settings

klahnakoski/mo-future

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

More Future!

For old code written against Python2, plus some tiny useful functions

Recent Changes

December 2022 - No longer points to Python2 modules.

Description

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 to the same 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

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

    from mo_future import text

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

About

More future! Make Python compatibility a little bit easier

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages