Easy, clean, reliable Python 2/3 compatibility¶
python-future is the missing compatibility layer between Python 2 and
Python 3. It allows you to use a single, clean Python 3.x-compatible
codebase to support both Python 2 and Python 3 with minimal overhead.
Contents¶
- What’s New
- Overview: Easy, clean, reliable Python 2/3 compatibility
- Quick-start guide
- Cheat Sheet: Writing Python 2-3 compatible code
- Imports
- What else you need to know
- Automatic conversion to Py2/3
- Frequently Asked Questions (FAQ)
- Standard library incompatibilities
- Older interfaces
- Changes in previous versions
- Changes in version 0.18.3 (2023年01月13日)
- Changes in version 0.18.2 (2019年10月30日)
- Changes in version 0.18.1 (2019年10月09日)
- Changes in version 0.18.0 (2019年10月09日)
- Changes in version 0.17.1 (2018年10月30日)
- Changes in version 0.17.0 (2018年10月19日)
- Changes in version 0.16.0 (2016年10月27日)
- Changes in version 0.15.2 (2015年09月11日)
- Changes in version 0.15.1 (2015年09月09日)
- Changes in version 0.15.0 (2015年07月25日)
- Changes in version 0.14.3 (2014年12月15日)
- Changes in version 0.14.2 (2014年11月21日)
- Changes in version 0.14.1 (2014年10月02日)
- Changes in version 0.14.0 (2014年10月02日)
- Changes in version 0.13.1 (2014年09月23日)
- Changes in version 0.13.0 (2014年08月13日)
- Changes in version 0.12.4 (2014年07月18日)
- Changes in version 0.12.3 (2014年06月19日)
- Changes in version 0.12.2 (2014年05月25日)
- Changes in version 0.12.1 (2014年05月14日)
- Changes in version 0.12.0 (2014年05月06日)
- More robust standard-library import hooks
newobjectbase object defines fallback Py2-compatible special methodspast.builtinsmodule improvedsurrogateescapeerror handlernewlisttypelistvaluesandlistitems- Tests
- Refactoring of
future.standard_library.*->future.backports - Backported
http.serverandurllibmodules - Internal refactoring
- Bug fixes
- Changes in version 0.11.4 (2014年05月25日)
- Changes in version 0.11.3 (2014年02月27日)
- Changes in version 0.11 (2014年01月28日)
- Changes in version 0.10.2 (2014年01月11日)
- Changes in version 0.10.0 (2013年12月02日)
- Changes in version 0.9 (2013年11月06日)
- Changes in version 0.8 (2013年10月28日)
- Summary of all changes
- Licensing and credits
- API Reference (in progress)
- future.builtins Interface
- Backported types from Python 3
- future.standard_library Interface
- Limitations
RenameImportcache_py2_modules()detect_hooks()disable_hooks()enable_hooks()exclude_local_folder_importsfrom_import()hooksimport_()install_aliases()install_hooks()is_py2_stdlib_module()remove_hooks()restore_sys_modules()scrub_future_sys_modules()scrub_py2_sys_modules()suspend_hooks
- future.utils Interface
as_native_str()binary_typebind_method()exec_()implements_iterator()is_new_style()isbytes()isidentifier()isint()isnewbytes()istext()iteritems()iterkeys()itervalues()native()native_bytesnative_strnative_str_to_bytes()old_div()python_2_unicode_compatible()raise_()raise_with_traceback()reraise()text_typetobytes()viewitems()viewkeys()viewvalues()with_metaclass()
- past.builtins Interface
- Forward-ported types from Python 2