Fork me on GitHub
Python-Future
  • Overview
  • Cheat Sheet
  • FAQ
  • Contents
      • What’s New
        • What’s new in version 0.18.2 (2019-10-30)
        • What’s new in version 0.18.1 (2019-10-09)
        • What’s new in version 0.18.0 (2019-10-09)
        • What’s new in version 0.17.1 (2018-10-30)
        • What’s new in version 0.17.0 (2018-10-19)
        • What’s new in version 0.16.0 (2016-10-27)
        • What’s new in version 0.15.2 (2015-09-11)
        • What’s new in version 0.15.1 (2015-09-09)
        • What’s new in version 0.15.0 (2015-07-25)
        • Previous versions
      • Overview: Easy, clean, reliable Python 2/3 compatibility
        • Features
        • Code examples
        • Automatic conversion to Py2/3-compatible code
          • Futurize: 2 to both
        • Automatic translation
        • Licensing
        • Next steps
      • Quick-start guide
        • Installation
        • If you are writing code from scratch
        • To convert existing Python 3 code
        • To convert existing Python 2 code
        • Standard library reorganization
        • Python 2-only dependencies
        • Next steps
      • Cheat Sheet: Writing Python 2-3 compatible code
        • Setup
        • Essential syntax differences
          • print
          • Raising exceptions
          • Catching exceptions
          • Division
          • Long integers
          • Octal constants
          • Backtick repr
          • Metaclasses
        • Strings and bytes
          • Unicode (text) string literals
          • Byte-string literals
          • basestring
          • unicode
          • StringIO
        • Imports relative to a package
        • Dictionaries
          • Iterating through dict keys/values/items
          • dict keys/values/items as a list
        • Custom class behaviour
          • Custom iterators
          • Custom __str__ methods
          • Custom __nonzero__ vs __bool__ method:
        • Lists versus iterators
          • xrange
          • range
          • map
          • imap
          • zip, izip
          • filter, ifilter
        • Other builtins
          • File IO with open()
          • reduce()
          • raw_input()
          • input()
          • file()
          • exec
          • execfile()
          • unichr()
          • intern()
          • apply()
          • chr()
          • cmp()
          • reload()
        • Standard library
          • dbm modules
          • commands / subprocess modules
          • StringIO module
          • http module
          • xmlrpc module
          • html escaping and entities
          • html parsing
          • urllib module
          • Tkinter
          • socketserver
          • copy_reg, copyreg
          • configparser
          • queue
          • repr, reprlib
          • UserDict, UserList, UserString
          • itertools: filterfalse, zip_longest
      • Imports
        • __future__ imports
        • Imports of builtins
          • Implicit imports
          • Explicit imports
        • Standard library imports
          • Direct imports
          • Aliased imports
        • External standard-library backports
        • Included full backports
        • Using Python 2-only dependencies on Python 3
        • Should I import unicode_literals?
          • Benefits
          • Drawbacks
          • Others’ perspectives
        • Next steps
      • What else you need to know
        • bytes
        • str
        • dict
          • Memory-efficiency and alternatives
        • int
        • isinstance
        • Passing data to/from Python 2 libraries
        • Native string type
        • open()
        • Custom __str__ methods
        • Custom iterators
        • Binding a method to a class
        • Metaclasses
      • Automatic conversion to Py2/3
        • futurize: Py2 to Py2/3
          • Stage 1: “safe” fixes
          • Stage 2: Py3-style code with wrappers for Py2
          • Separating text from bytes
          • Post-conversion
        • futurize quick-start guide
          • Step 0: setup
          • Step 1: modern Py2 code
          • Step 2: working Py3 code that still supports Py2
        • pasteurize: Py3 to Py2/3
        • Known limitations
      • Frequently Asked Questions (FAQ)
        • Who is this for?
        • Why upgrade to Python 3?
        • Porting philosophy
          • Why write Python 3-style code?
          • Can’t I just roll my own Py2/3 compatibility layer?
          • What inspired this project?
        • Maturity
          • How well has it been tested?
          • Is the API stable?
        • Relationship between python-future and other compatibility tools
          • How does this relate to 2to3?
          • Can I maintain a Python 2 codebase and use 2to3 to automatically convert to Python 3 in the setup script?
          • What is the relationship between future and six?
          • What is the relationship between python-future and python-modernize?
        • Platform and version support
          • Which versions of Python does python-future support?
        • Support
          • Is there a mailing list?
        • Contributing
          • Can I help?
          • Where is the repo?
      • Standard library incompatibilities
        • array.array()
        • array.array.read()
        • base64.decodebytes() and base64.encodebytes()
        • re.ASCII
        • struct.pack()
      • Older interfaces
        • future.moves interface
          • Comparing future.moves and six.moves
        • import_ and from_import functions
        • Context-manager for import hooks
        • install_hooks() call (deprecated)
      • Changes in previous versions
        • 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)
          • Bug fixes
          • Internal cleanups
          • Deprecations
        • Changes in version 0.13.1 (2014-09-23)
        • Changes in version 0.13.0 (2014-08-13)
          • Deprecations
          • New features
          • Bug fixes
        • 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
          • newobject base object defines fallback Py2-compatible special methods
          • past.builtins module improved
          • surrogateescape error handler
          • newlist type
          • listvalues and listitems
          • Tests
          • Refactoring of future.standard_library.* -> future.backports
          • Backported http.server and urllib modules
          • Internal refactoring
          • Bug fixes
        • Changes in version 0.11.4 (2014-05-25)
        • Changes in version 0.11.3 (2014-02-27)
          • Improved compatibility with requests
          • Conversion scripts explicitly install import hooks
          • futurize script no longer adds unicode_literals by default
        • Changes in version 0.11 (2014-01-28)
          • past package
          • Auto-translation of Python 2 modules upon import
          • Separate pasteurize script
          • pow()
          • input() no longer disabled globally on Py2
          • Deprecated feature: auto-installation of standard-library import hooks
          • Internal changes
        • Changes in version 0.10.2 (2014-01-11)
          • New context-manager interface to standard_library.hooks
        • Changes in version 0.10.0 (2013-12-02)
          • Backported dict type
          • Utility functions raise_ and exec_
          • Bugfixes
        • Changes in version 0.9 (2013-11-06)
          • isinstance checks are supported natively with backported types
          • futurize: minimal imports by default
          • Looser type-checking for the backported str object
          • suspend_hooks() context manager added to future.standard_library
        • Changes in version 0.8 (2013-10-28)
          • Python 2.6 support
          • Unused modules removed
          • isinstance() added to future.builtins (v0.8.2)
        • Summary of all changes
      • Licensing and credits
        • Licence
        • Sponsors
        • Maintainer
        • Authors
          • Suggestions and Feedback
        • Other Credits
      • API Reference (in progress)
        • future.builtins Interface
        • Backported types from Python 3
          • For more information:
          • range()
          • super()
          • round()
        • future.standard_library Interface
          • Limitations
        • future.utils Interface
        • past.builtins Interface
        • Forward-ported types from Python 2
  • Page

    Easy, clean, reliable Python 2/3 compatibility

    Table of 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
    • Licensing and credits
    • API Reference (in progress)

    All modules for which code is available

    • _functools
    • builtins
    • future.standard_library
    • future.utils
    • imp
    • past.builtins.misc
    • past.builtins.noniterators
    • past.types.basestring
    • past.types.olddict
    • past.types.oldstr
    • sys

    Back to top

    © Copyright 2013-2019, Python Charmers Pty Ltd, Australia.