88codebase with minimal cruft and run it easily on Python 2 without further
99modification.
1010
11+ ``future `` comes with ``futurize ``, a script that helps you to transition
12+ to supporting both Python 2 and 3 in a single codebase, module by module.
1113
1214.. _features :
1315
@@ -20,10 +22,10 @@ Features
2022- 300+ unit tests
2123- ``futurize `` script based on ``2to3 ``, ``3to2 `` and parts of
2224 ``python-modernize `` for automatic conversion from either Py2 or Py3 to a
23- clean single-source codebase compatible with both Py3 and Py2
25+ clean single-source codebase compatible with Python 2.6+ and Python 3.3+.
2426- a consistent set of utility functions and decorators selected from
25- Py2/3 compatibility interfaces from projects like six, IPython,
26- Jinja2, Django, and Pandas.
27+ Py2/3 compatibility interfaces from projects like `` six ``, `` IPython `` ,
28+ `` Jinja2 ``, `` Django `` , and `` Pandas `` .
2729
2830
2931.. _code-examples :
@@ -42,8 +44,8 @@ together with Python's built-in ``__future__`` module like this::
4244followed by standard Python 3 code. The imports have no effect on Python
43453 but allow the code to run mostly unchanged on Python 3 and Python 2.6/2.7.
4446
45- For example, after these imports, this code runs identically on Python 3
46- and 2.6/2.7 ::
47+ For example, this code behaves the same way on Python 2.6/2.7 after these
48+ imports as it normally does on Python 3 ::
4749
4850 # Support for renamed standard library modules via import hooks
4951 from http.client import HttpConnection
@@ -61,13 +63,13 @@ and 2.6/2.7::
6163
6264 # Backported Py3 str object
6365 s = str(u'ABCD')
64- assert s != b'ABCD'
66+ assert s != bytes( b'ABCD')
6567 assert isinstance(s.encode('utf-8'), bytes)
6668 assert isinstance(b.decode('utf-8'), str)
6769 assert repr(s) == 'ABCD' # consistent repr with Py3 (no u prefix)
6870 # These raise TypeErrors:
69- # b'B' in s
70- # s.find(b'A')
71+ # bytes( b'B') in s
72+ # s.find(bytes( b'A') )
7173
7274 # Extra arguments for the open() function
7375 f = open('japanese.txt', encoding='utf-8', errors='replace')
0 commit comments