|
Original |
Translation |
|
27
|
Each step of transforming code is encapsulated in a fixer. The command ``2to3 -l`` lists them. As :ref:`documented above <2to3-using>`, each can be turned on and off individually. They are described here in more detail.
|
|
|
28
|
Removes usage of :func:`apply`. For example ``apply(function, *args, **kwargs)`` is converted to ``function(*args, **kwargs)``.
|
|
|
29
|
Converts :class:`basestring` to :class:`str`.
|
|
|
30
|
Converts :class:`buffer` to :class:`memoryview`. This fixer is optional because the :class:`memoryview` API is similar but not exactly the same as that of :class:`buffer`.
|
|
|
31
|
|
32
|
Fixes dictionary iteration methods. :meth:`dict.iteritems` is converted to :meth:`dict.items`, :meth:`dict.iterkeys` to :meth:`dict.keys`, and :meth:`dict.itervalues` to :meth:`dict.values`. Similarly, :meth:`dict.viewitems`, :meth:`dict.viewkeys` and :meth:`dict.viewvalues` are converted respectively to :meth:`dict.items`, :meth:`dict.keys` and :meth:`dict.values`. It also wraps existing usages of :meth:`dict.items`, :meth:`dict.keys`, and :meth:`dict.values` in a call to :class:`list`.
|
|
|
33
|
Converts ``except X, T`` to ``except X as T``.
|
|
|
34
|
Converts the :keyword:`exec` statement to the :func:`exec` function.
|
|
|
35
|
Removes usage of :func:`execfile`. The argument to :func:`execfile` is wrapped in calls to :func:`open`, :func:`compile`, and :func:`exec`.
|
|
|
36
|
Changes assignment of :attr:`sys.exitfunc` to use of the :mod:`atexit` module.
|
|