[Python-ideas] Add `future_builtins` as an alias for `builtins`

Sven Marnach sven at marnach.net
Wed May 9 20:48:56 CEST 2012


With the reintroduction of u"Unicode literals", Python 3.3 will remove
one of the major stumbling stones for supporting Python 2.x and 3.3
within the same code base.  Another rather trivial stumbling stone
could be removed by adding the alias `future_builtins` for the
`builtins` module.  Currently, you need to use a try/except block,
which isn't too bad, but I think it would be nicer if a line like

    from future_builtins import map

continues to work, just like __future__ imports continue to work.  I
think the above actually *is* a kind of __future__ report which just
happens to be in a regular module because it doesn't need any special
compiler support.

I know a few module names changed and some modules have been
reorganised to packages, so you will still need try/except blocks for
other imports.  However, I think `future_builtins` is special because
it's sole raison d'être is forward-compatibility and becuase of the
analogy with `__future__`.

Cheers,
    Sven



More information about the Python-ideas mailing list