__init__.py 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. """
  2. future: Easy, safe support for Python 2/3 compatibility
  3. =======================================================
  4. ``future`` is the missing compatibility layer between Python 2 and Python
  5. 3. It allows you to use a single, clean Python 3.x-compatible codebase to
  6. support both Python 2 and Python 3 with minimal overhead.
  7. It is designed to be used as follows::
  8. from __future__ import (absolute_import, division,
  9. print_function, unicode_literals)
  10. from builtins import (
  11. bytes, dict, int, list, object, range, str,
  12. ascii, chr, hex, input, next, oct, open,
  13. pow, round, super,
  14. filter, map, zip)
  15. followed by predominantly standard, idiomatic Python 3 code that then runs
  16. similarly on Python 2.6/2.7 and Python 3.3+.
  17. The imports have no effect on Python 3. On Python 2, they shadow the
  18. corresponding builtins, which normally have different semantics on Python 3
  19. versus 2, to provide their Python 3 semantics.
  20. Standard library reorganization
  21. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  22. ``future`` supports the standard library reorganization (PEP 3108) through the
  23. following Py3 interfaces:
  24. >>> # Top-level packages with Py3 names provided on Py2:
  25. >>> import html.parser
  26. >>> import queue
  27. >>> import tkinter.dialog
  28. >>> import xmlrpc.client
  29. >>> # etc.
  30. >>> # Aliases provided for extensions to existing Py2 module names:
  31. >>> from future.standard_library import install_aliases
  32. >>> install_aliases()
  33. >>> from collections import Counter, OrderedDict # backported to Py2.6
  34. >>> from collections import UserDict, UserList, UserString
  35. >>> import urllib.request
  36. >>> from itertools import filterfalse, zip_longest
  37. >>> from subprocess import getoutput, getstatusoutput
  38. Automatic conversion
  39. --------------------
  40. An included script called `futurize
  41. <http://python-future.org/automatic_conversion.html>`_ aids in converting
  42. code (from either Python 2 or Python 3) to code compatible with both
  43. platforms. It is similar to ``python-modernize`` but goes further in
  44. providing Python 3 compatibility through the use of the backported types
  45. and builtin functions in ``future``.
  46. Documentation
  47. -------------
  48. See: http://python-future.org
  49. Credits
  50. -------
  51. :Author: Ed Schofield, Jordan M. Adler, et al
  52. :Sponsor: Python Charmers Pty Ltd, Australia, and Python Charmers Pte
  53. Ltd, Singapore. http://pythoncharmers.com
  54. :Others: See docs/credits.rst or http://python-future.org/credits.html
  55. Licensing
  56. ---------
  57. Copyright 2013-2019 Python Charmers Pty Ltd, Australia.
  58. The software is distributed under an MIT licence. See LICENSE.txt.
  59. """
  60. __title__ = 'future'
  61. __author__ = 'Ed Schofield'
  62. __license__ = 'MIT'
  63. __copyright__ = 'Copyright 2013-2019 Python Charmers Pty Ltd'
  64. __ver_major__ = 0
  65. __ver_minor__ = 18
  66. __ver_patch__ = 2
  67. __ver_sub__ = ''
  68. __version__ = "%d.%d.%d%s" % (__ver_major__, __ver_minor__,
  69. __ver_patch__, __ver_sub__)