@@ -57,7 +57,9 @@ Code examples
5757Replacements for Py2's built-in functions and types are designed to be imported
5858at the top of each Python module together with Python's built-in ``__future__ ``
5959statements. For example, this code behaves identically on Python 2.6/2.7 after
60- these imports as it does on Python 3.3+::
60+ these imports as it does on Python 3.3+:
61+
62+ .. code-block :: python
6163
6264 from __future__ import absolute_import, division, print_function
6365 from future.builtins import (bytes , str , open , super , range ,
@@ -127,7 +129,9 @@ these imports as it does on Python 3.3+::
127129
128130
129131 There is also support for renamed standard library modules in the form of import
130- hooks. The context-manager form works like this::
132+ hooks. The context-manager form works like this:
133+
134+ .. code-block :: python
131135
132136 from future import standard_library
133137
@@ -164,15 +168,19 @@ mostly unchanged on both Python 2 and Python 3.
164168Futurize: 2 to both
165169--------------------
166170
167- For example, running ``futurize -w mymodule.py `` turns this Python 2 code::
171+ For example, running ``futurize -w mymodule.py `` turns this Python 2 code:
172+
173+ .. code-block :: python
168174
169175 import ConfigParser
170176
171177 class Blah (object ):
172178 pass
173179 print ' Hello' ,
174180
175- into this code which runs on both Py2 and Py3::
181+ into this code which runs on both Py2 and Py3:
182+
183+ .. code-block :: python
176184
177185 from __future__ import print_function
178186 from future import standard_library
@@ -196,14 +204,18 @@ The ``past`` package can now automatically translate some simple Python 2
196204modules to Python 3 upon import. The goal is to support the "long tail" of
197205real-world Python 2 modules (e.g. on PyPI) that have not been ported yet. For
198206example, here is how to use a Python 2-only package called ``plotrique `` on
199- Python 3. First install it::
207+ Python 3. First install it:
208+
209+ .. code-block :: bash
200210
201211 $ pip3 install plotrique==0.2.5-7 --no-compile # to ignore SyntaxErrors
202212
203213 (or use ``pip `` if this points to your Py3 environment.)
204214
205215Then pass a whitelist of module name prefixes to the ``autotranslate() `` function.
206- Example::
216+ Example:
217+
218+ .. code-block :: bash
207219
208220 $ python3
209221
0 commit comments