blob: fa4b0a9645531c4792d0116a226cd9ea13b8f83a [file] [log] [blame]
Benjamin Petersond6313712008-07-31 16:23:04 +00001.. _2to3-reference:
2
32to3 - Automated Python 2 to 3 code translation
4===============================================
5
Benjamin Peterson058e31e2009-01-16 03:54:08 +00006.. sectionauthor:: Benjamin Peterson <benjamin@python.org>
Benjamin Petersond6313712008-07-31 16:23:04 +00007
Benjamin Peterson8951b612008-09-03 02:27:16 +000082to3 is a Python program that reads Python 2.x source code and applies a series
9of *fixers* to transform it into valid Python 3.x code. The standard library
Benjamin Petersonae5360b2008-09-08 23:05:23 +000010contains a rich set of fixers that will handle almost all code. 2to3 supporting
11library :mod:`lib2to3` is, however, a flexible and generic library, so it is
12possible to write your own fixers for 2to3. :mod:`lib2to3` could also be
13adapted to custom applications in which Python code needs to be edited
14automatically.
Benjamin Petersond6313712008-07-31 16:23:04 +000015
16
Benjamin Petersonf91df042009-02-13 02:50:59 +000017.. _2to3-using:
18
Benjamin Petersond6313712008-07-31 16:23:04 +000019Using 2to3
20----------
21
Benjamin Petersonae5360b2008-09-08 23:05:23 +0000222to3 will usually be installed with the Python interpreter as a script. It is
23also located in the :file:`Tools/scripts` directory of the Python root.
24
252to3's basic arguments are a list of files or directories to transform. The
Chris Jerdonek46397492012-10-11 15:59:32 -070026directories are recursively traversed for Python sources.
Benjamin Petersond6313712008-07-31 16:23:04 +000027
28Here is a sample Python 2.x source file, :file:`example.py`::
29
30 def greet(name):
31 print "Hello, {0}!".format(name)
32 print "What's your name?"
33 name = raw_input()
34 greet(name)
35
Martin Panter1050d2d2016-07-26 11:18:21 +020036It can be converted to Python 3.x code via 2to3 on the command line:
37
38.. code-block:: shell-session
Benjamin Petersond6313712008-07-31 16:23:04 +000039
40 $ 2to3 example.py
41
Benjamin Petersonae5360b2008-09-08 23:05:23 +000042A diff against the original source file is printed. 2to3 can also write the
Benjamin Petersonad3d5c22009-02-26 03:38:59 +000043needed modifications right back to the source file. (A backup of the original
Martin Panter5c679332016-10-30 04:20:17 +000044file is made unless :option:`!-n` is also given.) Writing the changes back is
45enabled with the :option:`!-w` flag:
Martin Panter1050d2d2016-07-26 11:18:21 +020046
47.. code-block:: shell-session
Benjamin Petersond6313712008-07-31 16:23:04 +000048
49 $ 2to3 -w example.py
50
Benjamin Petersonae5360b2008-09-08 23:05:23 +000051After transformation, :file:`example.py` looks like this::
Benjamin Petersond6313712008-07-31 16:23:04 +000052
53 def greet(name):
54 print("Hello, {0}!".format(name))
55 print("What's your name?")
56 name = input()
57 greet(name)
58
Benjamin Peterson1a6e0d02008-10-25 15:49:17 +000059Comments and exact indentation are preserved throughout the translation process.
Benjamin Petersond6313712008-07-31 16:23:04 +000060
Benjamin Petersonf91df042009-02-13 02:50:59 +000061By default, 2to3 runs a set of :ref:`predefined fixers <2to3-fixers>`. The
Martin Panter254da192016-07-26 06:46:06 +000062:option:`!-l` flag lists all available fixers. An explicit set of fixers to run
Martin Panter5c679332016-10-30 04:20:17 +000063can be given with :option:`!-f`. Likewise the :option:`!-x` explicitly disables a
Martin Panter1050d2d2016-07-26 11:18:21 +020064fixer. The following example runs only the ``imports`` and ``has_key`` fixers:
65
66.. code-block:: shell-session
Benjamin Petersond6313712008-07-31 16:23:04 +000067
68 $ 2to3 -f imports -f has_key example.py
69
Martin Panter1050d2d2016-07-26 11:18:21 +020070This command runs every fixer except the ``apply`` fixer:
71
72.. code-block:: shell-session
Benjamin Peterson206e3072008-10-19 14:07:49 +000073
74 $ 2to3 -x apply example.py
75
Benjamin Peterson1a6e0d02008-10-25 15:49:17 +000076Some fixers are *explicit*, meaning they aren't run by default and must be
Benjamin Petersonae5360b2008-09-08 23:05:23 +000077listed on the command line to be run. Here, in addition to the default fixers,
Martin Panter1050d2d2016-07-26 11:18:21 +020078the ``idioms`` fixer is run:
79
80.. code-block:: shell-session
Benjamin Petersond6313712008-07-31 16:23:04 +000081
82 $ 2to3 -f all -f idioms example.py
83
Benjamin Petersonae5360b2008-09-08 23:05:23 +000084Notice how passing ``all`` enables all default fixers.
Benjamin Petersond6313712008-07-31 16:23:04 +000085
Benjamin Peterson1a6e0d02008-10-25 15:49:17 +000086Sometimes 2to3 will find a place in your source code that needs to be changed,
87but 2to3 cannot fix automatically. In this case, 2to3 will print a warning
88beneath the diff for a file. You should address the warning in order to have
89compliant 3.x code.
Benjamin Petersonae5360b2008-09-08 23:05:23 +000090
Martin Panter00ccacc2016-04-16 04:59:38 +0000912to3 can also refactor doctests. To enable this mode, use the :option:`!-d`
Benjamin Petersone9bbc8b2008-09-28 02:06:32 +000092flag. Note that *only* doctests will be refactored. This also doesn't require
93the module to be valid Python. For example, doctest like examples in a reST
94document could also be refactored with this option.
Benjamin Petersonae5360b2008-09-08 23:05:23 +000095
Martin Panter00ccacc2016-04-16 04:59:38 +000096The :option:`!-v` option enables output of more information on the translation
Benjamin Peterson206e3072008-10-19 14:07:49 +000097process.
Benjamin Petersonae5360b2008-09-08 23:05:23 +000098
Benjamin Petersona0dfa822009-11-13 02:25:08 +000099Since some print statements can be parsed as function calls or statements, 2to3
100cannot always read files containing the print function. When 2to3 detects the
101presence of the ``from __future__ import print_function`` compiler directive, it
Georg Brandl6faee4e2010-09-21 14:48:28 +0000102modifies its internal grammar to interpret :func:`print` as a function. This
Martin Panter5c679332016-10-30 04:20:17 +0000103change can also be enabled manually with the :option:`!-p` flag. Use
104:option:`!-p` to run fixers on code that already has had its print statements
Benjamin Petersona0dfa822009-11-13 02:25:08 +0000105converted.
106
Martin Panter5c679332016-10-30 04:20:17 +0000107The :option:`!-o` or :option:`!--output-dir` option allows specification of an
Gregory P. Smith58f23ff2012-02-12 15:50:21 -0800108alternate directory for processed output files to be written to. The
Martin Panter5c679332016-10-30 04:20:17 +0000109:option:`!-n` flag is required when using this as backup files do not make sense
Gregory P. Smith58f23ff2012-02-12 15:50:21 -0800110when not overwriting the input files.
111
112.. versionadded:: 3.2.3
Martin Panter5c679332016-10-30 04:20:17 +0000113 The :option:`!-o` option was added.
Gregory P. Smith58f23ff2012-02-12 15:50:21 -0800114
Martin Panter5c679332016-10-30 04:20:17 +0000115The :option:`!-W` or :option:`!--write-unchanged-files` flag tells 2to3 to always
Gregory P. Smith58f23ff2012-02-12 15:50:21 -0800116write output files even if no changes were required to the file. This is most
Martin Panter5c679332016-10-30 04:20:17 +0000117useful with :option:`!-o` so that an entire Python source tree is copied with
Gregory P. Smith58f23ff2012-02-12 15:50:21 -0800118translation from one directory to another.
Martin Panter5c679332016-10-30 04:20:17 +0000119This option implies the :option:`!-w` flag as it would not make sense otherwise.
Gregory P. Smith58f23ff2012-02-12 15:50:21 -0800120
121.. versionadded:: 3.2.3
Martin Panter00ccacc2016-04-16 04:59:38 +0000122 The :option:`!-W` flag was added.
Gregory P. Smith58f23ff2012-02-12 15:50:21 -0800123
Martin Panter5c679332016-10-30 04:20:17 +0000124The :option:`!--add-suffix` option specifies a string to append to all output
125filenames. The :option:`!-n` flag is required when specifying this as backups
Martin Panter1050d2d2016-07-26 11:18:21 +0200126are not necessary when writing to different filenames. Example:
127
128.. code-block:: shell-session
Gregory P. Smith58f23ff2012-02-12 15:50:21 -0800129
130 $ 2to3 -n -W --add-suffix=3 example.py
131
132Will cause a converted file named ``example.py3`` to be written.
133
134.. versionadded:: 3.2.3
Martin Panter5c679332016-10-30 04:20:17 +0000135 The :option:`!--add-suffix` option was added.
Gregory P. Smith58f23ff2012-02-12 15:50:21 -0800136
Martin Panter1050d2d2016-07-26 11:18:21 +0200137To translate an entire project from one directory tree to another use:
138
139.. code-block:: shell-session
Gregory P. Smith58f23ff2012-02-12 15:50:21 -0800140
141 $ 2to3 --output-dir=python3-version/mycode -W -n python2-version/mycode
142
Benjamin Petersonf91df042009-02-13 02:50:59 +0000143
144.. _2to3-fixers:
145
146Fixers
147------
148
Georg Brandlae2dbe22009-03-13 19:04:40 +0000149Each step of transforming code is encapsulated in a fixer. The command ``2to3
Benjamin Petersonf91df042009-02-13 02:50:59 +0000150-l`` lists them. As :ref:`documented above <2to3-using>`, each can be turned on
151and off individually. They are described here in more detail.
152
153
154.. 2to3fixer:: apply
155
156 Removes usage of :func:`apply`. For example ``apply(function, *args,
157 **kwargs)`` is converted to ``function(*args, **kwargs)``.
158
Ezio Melotti6bdd9862013-11-23 21:14:42 +0200159.. 2to3fixer:: asserts
160
161 Replaces deprecated :mod:`unittest` method names with the correct ones.
162
163 ================================ ==========================================
164 From To
165 ================================ ==========================================
166 ``failUnlessEqual(a, b)`` :meth:`assertEqual(a, b)
167 <unittest.TestCase.assertEqual>`
168 ``assertEquals(a, b)`` :meth:`assertEqual(a, b)
169 <unittest.TestCase.assertEqual>`
170 ``failIfEqual(a, b)`` :meth:`assertNotEqual(a, b)
171 <unittest.TestCase.assertNotEqual>`
172 ``assertNotEquals(a, b)`` :meth:`assertNotEqual(a, b)
173 <unittest.TestCase.assertNotEqual>`
174 ``failUnless(a)`` :meth:`assertTrue(a)
175 <unittest.TestCase.assertTrue>`
176 ``assert_(a)`` :meth:`assertTrue(a)
177 <unittest.TestCase.assertTrue>`
178 ``failIf(a)`` :meth:`assertFalse(a)
179 <unittest.TestCase.assertFalse>`
180 ``failUnlessRaises(exc, cal)`` :meth:`assertRaises(exc, cal)
181 <unittest.TestCase.assertRaises>`
182 ``failUnlessAlmostEqual(a, b)`` :meth:`assertAlmostEqual(a, b)
183 <unittest.TestCase.assertAlmostEqual>`
184 ``assertAlmostEquals(a, b)`` :meth:`assertAlmostEqual(a, b)
185 <unittest.TestCase.assertAlmostEqual>`
186 ``failIfAlmostEqual(a, b)`` :meth:`assertNotAlmostEqual(a, b)
187 <unittest.TestCase.assertNotAlmostEqual>`
188 ``assertNotAlmostEquals(a, b)`` :meth:`assertNotAlmostEqual(a, b)
189 <unittest.TestCase.assertNotAlmostEqual>`
190 ================================ ==========================================
191
Benjamin Petersonf91df042009-02-13 02:50:59 +0000192.. 2to3fixer:: basestring
193
194 Converts :class:`basestring` to :class:`str`.
195
196.. 2to3fixer:: buffer
197
198 Converts :class:`buffer` to :class:`memoryview`. This fixer is optional
199 because the :class:`memoryview` API is similar but not exactly the same as
200 that of :class:`buffer`.
201
Benjamin Petersonf91df042009-02-13 02:50:59 +0000202.. 2to3fixer:: dict
203
204 Fixes dictionary iteration methods. :meth:`dict.iteritems` is converted to
205 :meth:`dict.items`, :meth:`dict.iterkeys` to :meth:`dict.keys`, and
Alexandre Vassalottia515bab2010-01-12 18:38:14 +0000206 :meth:`dict.itervalues` to :meth:`dict.values`. Similarly,
Benjamin Petersone90f54e2010-03-21 23:17:57 +0000207 :meth:`dict.viewitems`, :meth:`dict.viewkeys` and :meth:`dict.viewvalues` are
208 converted respectively to :meth:`dict.items`, :meth:`dict.keys` and
Alexandre Vassalottia515bab2010-01-12 18:38:14 +0000209 :meth:`dict.values`. It also wraps existing usages of :meth:`dict.items`,
210 :meth:`dict.keys`, and :meth:`dict.values` in a call to :class:`list`.
Benjamin Petersonf91df042009-02-13 02:50:59 +0000211
212.. 2to3fixer:: except
213
214 Converts ``except X, T`` to ``except X as T``.
215
216.. 2to3fixer:: exec
217
Georg Brandl375aec22011-01-15 17:03:02 +0000218 Converts the ``exec`` statement to the :func:`exec` function.
Benjamin Petersonf91df042009-02-13 02:50:59 +0000219
220.. 2to3fixer:: execfile
221
222 Removes usage of :func:`execfile`. The argument to :func:`execfile` is
223 wrapped in calls to :func:`open`, :func:`compile`, and :func:`exec`.
224
Benjamin Petersone90f54e2010-03-21 23:17:57 +0000225.. 2to3fixer:: exitfunc
226
227 Changes assignment of :attr:`sys.exitfunc` to use of the :mod:`atexit`
228 module.
229
Benjamin Petersonf91df042009-02-13 02:50:59 +0000230.. 2to3fixer:: filter
231
232 Wraps :func:`filter` usage in a :class:`list` call.
233
234.. 2to3fixer:: funcattrs
235
236 Fixes function attributes that have been renamed. For example,
237 ``my_function.func_closure`` is converted to ``my_function.__closure__``.
238
239.. 2to3fixer:: future
240
241 Removes ``from __future__ import new_feature`` statements.
242
243.. 2to3fixer:: getcwdu
244
245 Renames :func:`os.getcwdu` to :func:`os.getcwd`.
246
247.. 2to3fixer:: has_key
248
249 Changes ``dict.has_key(key)`` to ``key in dict``.
250
251.. 2to3fixer:: idioms
252
Georg Brandlae2dbe22009-03-13 19:04:40 +0000253 This optional fixer performs several transformations that make Python code
254 more idiomatic. Type comparisons like ``type(x) is SomeClass`` and
Benjamin Petersonf91df042009-02-13 02:50:59 +0000255 ``type(x) == SomeClass`` are converted to ``isinstance(x, SomeClass)``.
256 ``while 1`` becomes ``while True``. This fixer also tries to make use of
Georg Brandlae2dbe22009-03-13 19:04:40 +0000257 :func:`sorted` in appropriate places. For example, this block ::
Benjamin Petersonf91df042009-02-13 02:50:59 +0000258
259 L = list(some_iterable)
260 L.sort()
261
262 is changed to ::
263
264 L = sorted(some_iterable)
265
266.. 2to3fixer:: import
267
268 Detects sibling imports and converts them to relative imports.
269
270.. 2to3fixer:: imports
271
272 Handles module renames in the standard library.
273
274.. 2to3fixer:: imports2
275
276 Handles other modules renames in the standard library. It is separate from
277 the :2to3fixer:`imports` fixer only because of technical limitations.
278
279.. 2to3fixer:: input
280
Martin Panterd21e0b52015-10-10 10:36:22 +0000281 Converts ``input(prompt)`` to ``eval(input(prompt))``.
Benjamin Petersonf91df042009-02-13 02:50:59 +0000282
283.. 2to3fixer:: intern
284
285 Converts :func:`intern` to :func:`sys.intern`.
286
287.. 2to3fixer:: isinstance
288
289 Fixes duplicate types in the second argument of :func:`isinstance`. For
290 example, ``isinstance(x, (int, int))`` is converted to ``isinstance(x,
Eli Boyarski26248ef2017-07-24 03:39:07 +0300291 int)`` and ``isinstance(x, (int, float, int))`` is converted to
292 ``isinstance(x, (int, float))``.
Benjamin Petersonf91df042009-02-13 02:50:59 +0000293
294.. 2to3fixer:: itertools_imports
295
296 Removes imports of :func:`itertools.ifilter`, :func:`itertools.izip`, and
297 :func:`itertools.imap`. Imports of :func:`itertools.ifilterfalse` are also
298 changed to :func:`itertools.filterfalse`.
299
300.. 2to3fixer:: itertools
301
302 Changes usage of :func:`itertools.ifilter`, :func:`itertools.izip`, and
Georg Brandl22b34312009-07-26 14:54:51 +0000303 :func:`itertools.imap` to their built-in equivalents.
Benjamin Petersonf91df042009-02-13 02:50:59 +0000304 :func:`itertools.ifilterfalse` is changed to :func:`itertools.filterfalse`.
305
306.. 2to3fixer:: long
307
Benjamin Peterson4dafd402013-01-28 18:28:38 -0500308 Renames :class:`long` to :class:`int`.
Benjamin Petersonf91df042009-02-13 02:50:59 +0000309
310.. 2to3fixer:: map
311
312 Wraps :func:`map` in a :class:`list` call. It also changes ``map(None, x)``
313 to ``list(x)``. Using ``from future_builtins import map`` disables this
314 fixer.
315
316.. 2to3fixer:: metaclass
317
318 Converts the old metaclass syntax (``__metaclass__ = Meta`` in the class
319 body) to the new (``class X(metaclass=Meta)``).
320
321.. 2to3fixer:: methodattrs
322
323 Fixes old method attribute names. For example, ``meth.im_func`` is converted
324 to ``meth.__func__``.
325
326.. 2to3fixer:: ne
327
328 Converts the old not-equal syntax, ``<>``, to ``!=``.
329
330.. 2to3fixer:: next
331
Georg Brandl502d9a52009-07-26 15:02:41 +0000332 Converts the use of iterator's :meth:`~iterator.next` methods to the
333 :func:`next` function. It also renames :meth:`next` methods to
Serhiy Storchakabfdcd432013-10-13 23:09:14 +0300334 :meth:`~iterator.__next__`.
Benjamin Petersonf91df042009-02-13 02:50:59 +0000335
336.. 2to3fixer:: nonzero
337
Serhiy Storchakabfdcd432013-10-13 23:09:14 +0300338 Renames :meth:`__nonzero__` to :meth:`~object.__bool__`.
Benjamin Petersonf91df042009-02-13 02:50:59 +0000339
340.. 2to3fixer:: numliterals
341
342 Converts octal literals into the new syntax.
343
Alexandre Vassalottiae780182010-08-05 07:12:18 +0000344.. 2to3fixer:: operator
345
346 Converts calls to various functions in the :mod:`operator` module to other,
347 but equivalent, function calls. When needed, the appropriate ``import``
Serhiy Storchaka0a2abdf2017-11-16 09:16:24 +0200348 statements are added, e.g. ``import collections.abc``. The following mapping
Alexandre Vassalottiae780182010-08-05 07:12:18 +0000349 are made:
350
Serhiy Storchaka0a2abdf2017-11-16 09:16:24 +0200351 ================================== =============================================
Alexandre Vassalottiae780182010-08-05 07:12:18 +0000352 From To
Serhiy Storchaka0a2abdf2017-11-16 09:16:24 +0200353 ================================== =============================================
Dong-hee Naa4895992017-11-29 01:26:56 +0900354 ``operator.isCallable(obj)`` ``callable(obj)``
Alexandre Vassalottiae780182010-08-05 07:12:18 +0000355 ``operator.sequenceIncludes(obj)`` ``operator.contains(obj)``
Serhiy Storchaka0a2abdf2017-11-16 09:16:24 +0200356 ``operator.isSequenceType(obj)`` ``isinstance(obj, collections.abc.Sequence)``
357 ``operator.isMappingType(obj)`` ``isinstance(obj, collections.abc.Mapping)``
Alexandre Vassalottiae780182010-08-05 07:12:18 +0000358 ``operator.isNumberType(obj)`` ``isinstance(obj, numbers.Number)``
359 ``operator.repeat(obj, n)`` ``operator.mul(obj, n)``
360 ``operator.irepeat(obj, n)`` ``operator.imul(obj, n)``
Serhiy Storchaka0a2abdf2017-11-16 09:16:24 +0200361 ================================== =============================================
Alexandre Vassalottiae780182010-08-05 07:12:18 +0000362
Benjamin Petersonf91df042009-02-13 02:50:59 +0000363.. 2to3fixer:: paren
364
365 Add extra parenthesis where they are required in list comprehensions. For
366 example, ``[x for x in 1, 2]`` becomes ``[x for x in (1, 2)]``.
367
368.. 2to3fixer:: print
369
Georg Brandl375aec22011-01-15 17:03:02 +0000370 Converts the ``print`` statement to the :func:`print` function.
Benjamin Petersonf91df042009-02-13 02:50:59 +0000371
Benjamin Petersonb51b5c42010-07-01 17:49:01 +0000372.. 2to3fixer:: raise
Benjamin Petersonf91df042009-02-13 02:50:59 +0000373
374 Converts ``raise E, V`` to ``raise E(V)``, and ``raise E, V, T`` to ``raise
375 E(V).with_traceback(T)``. If ``E`` is a tuple, the translation will be
376 incorrect because substituting tuples for exceptions has been removed in 3.0.
377
378.. 2to3fixer:: raw_input
379
380 Converts :func:`raw_input` to :func:`input`.
381
382.. 2to3fixer:: reduce
383
384 Handles the move of :func:`reduce` to :func:`functools.reduce`.
385
Benjamin Peterson448e81b2012-12-07 22:44:10 -0500386.. 2to3fixer:: reload
387
Berker Peksag7a3056f2018-07-23 09:49:08 +0300388 Converts :func:`reload` to :func:`importlib.reload`.
Benjamin Peterson448e81b2012-12-07 22:44:10 -0500389
Benjamin Petersonf91df042009-02-13 02:50:59 +0000390.. 2to3fixer:: renames
391
392 Changes :data:`sys.maxint` to :data:`sys.maxsize`.
393
394.. 2to3fixer:: repr
395
396 Replaces backtick repr with the :func:`repr` function.
397
398.. 2to3fixer:: set_literal
399
400 Replaces use of the :class:`set` constructor with set literals. This fixer
401 is optional.
402
Benjamin Petersona8195772014-05-31 13:16:49 -0700403.. 2to3fixer:: standarderror
Benjamin Petersonf91df042009-02-13 02:50:59 +0000404
405 Renames :exc:`StandardError` to :exc:`Exception`.
406
407.. 2to3fixer:: sys_exc
408
409 Changes the deprecated :data:`sys.exc_value`, :data:`sys.exc_type`,
410 :data:`sys.exc_traceback` to use :func:`sys.exc_info`.
411
412.. 2to3fixer:: throw
413
414 Fixes the API change in generator's :meth:`throw` method.
415
416.. 2to3fixer:: tuple_params
417
418 Removes implicit tuple parameter unpacking. This fixer inserts temporary
419 variables.
420
421.. 2to3fixer:: types
422
423 Fixes code broken from the removal of some members in the :mod:`types`
424 module.
425
426.. 2to3fixer:: unicode
427
428 Renames :class:`unicode` to :class:`str`.
429
430.. 2to3fixer:: urllib
431
432 Handles the rename of :mod:`urllib` and :mod:`urllib2` to the :mod:`urllib`
433 package.
434
435.. 2to3fixer:: ws_comma
436
437 Removes excess whitespace from comma separated items. This fixer is
438 optional.
439
440.. 2to3fixer:: xrange
441
442 Renames :func:`xrange` to :func:`range` and wraps existing :func:`range`
443 calls with :class:`list`.
444
445.. 2to3fixer:: xreadlines
446
447 Changes ``for x in file.xreadlines()`` to ``for x in file``.
448
449.. 2to3fixer:: zip
450
451 Wraps :func:`zip` usage in a :class:`list` call. This is disabled when
452 ``from future_builtins import zip`` appears.
Benjamin Petersond6313712008-07-31 16:23:04 +0000453
454
455:mod:`lib2to3` - 2to3's library
456-------------------------------
457
458.. module:: lib2to3
459 :synopsis: the 2to3 library
Terry Jan Reedyfa089b92016-06-11 15:02:54 -0400460
Benjamin Petersond6313712008-07-31 16:23:04 +0000461.. moduleauthor:: Guido van Rossum
462.. moduleauthor:: Collin Winter
Benjamin Peterson25c95f12009-05-08 20:42:26 +0000463.. moduleauthor:: Benjamin Peterson <benjamin@python.org>
Benjamin Petersond6313712008-07-31 16:23:04 +0000464
Terry Jan Reedyfa089b92016-06-11 15:02:54 -0400465**Source code:** :source:`Lib/lib2to3/`
466
467--------------
Benjamin Petersone9bbc8b2008-09-28 02:06:32 +0000468
Georg Brandle720c0a2009-04-27 16:20:50 +0000469.. note::
Benjamin Petersone9bbc8b2008-09-28 02:06:32 +0000470
471 The :mod:`lib2to3` API should be considered unstable and may change
472 drastically in the future.
473
Benjamin Petersond6313712008-07-31 16:23:04 +0000474.. XXX What is the public interface anyway?