With permission, add lots more details and references.
Add a couple of changes which are likely, but not definite. At least until Guido changes his mind. ;-)
This commit is contained in:
parent
1bd889d78c
commit
8ca944f9e1
58
pep-3000.txt
58
pep-3000.txt
|
@ -49,11 +49,12 @@ Core language
|
||||||
* Support only new-style classes; classic classes will be gone [1]_
|
* Support only new-style classes; classic classes will be gone [1]_
|
||||||
* Return iterators instead of lists where appropriate for atomic type methods
|
* Return iterators instead of lists where appropriate for atomic type methods
|
||||||
(e.g. ``dict.keys()``, ``dict.values()``, ``dict.items()``, etc.)
|
(e.g. ``dict.keys()``, ``dict.values()``, ``dict.items()``, etc.)
|
||||||
|
(Do we keep iter*() methods or remove them? I vote remove. -- nn)
|
||||||
* Replace ``print`` by a function [16]_
|
* Replace ``print`` by a function [16]_
|
||||||
* Do something so you can catch multiple exceptions using ``except E1,
|
* Do something so you can catch multiple exceptions using ``except E1,
|
||||||
E2, E3:``. Maybe use ``except E1, E2, E3 as err:`` if you want the
|
E2, E3:``. Maybe use ``except E1, E2, E3 as err:`` if you want the
|
||||||
error variable? [3]_
|
error variable? [3]_
|
||||||
* ``True`` and ``False`` become keywords [4]_
|
* ``None``, ``True`` and ``False`` become keywords [4]_
|
||||||
* ``as`` becomes a keyword [5]_
|
* ``as`` becomes a keyword [5]_
|
||||||
* Have list comprehensions be syntactic sugar for passing an
|
* Have list comprehensions be syntactic sugar for passing an
|
||||||
equivalent generator expression to ``list()``; as a consequence the
|
equivalent generator expression to ``list()``; as a consequence the
|
||||||
|
@ -61,6 +62,12 @@ Core language
|
||||||
* Comparisons other than ``==`` and ``!=`` between disparate types
|
* Comparisons other than ``==`` and ``!=`` between disparate types
|
||||||
will raise an exception unless explicitly supported by the type [6]_
|
will raise an exception unless explicitly supported by the type [6]_
|
||||||
* Exceptions will grow an attribute to store the traceback [13]_
|
* Exceptions will grow an attribute to store the traceback [13]_
|
||||||
|
* floats will not be acceptable as arguments in place of ints for operations
|
||||||
|
where floats are inadvertantly accepted (PyArg_ParseTuple() i & l formats)
|
||||||
|
* Imports will be absolute by default.
|
||||||
|
Relative imports must be explicitly specified [19]_
|
||||||
|
* __init__.py will be optional in sub-packages. __init__.py will still
|
||||||
|
be required for top-level packages.
|
||||||
|
|
||||||
To be removed:
|
To be removed:
|
||||||
|
|
||||||
|
@ -70,6 +77,12 @@ To be removed:
|
||||||
* ```x```: use ``repr(x)`` [2]_
|
* ```x```: use ``repr(x)`` [2]_
|
||||||
* The ``<>`` operator: use ``!=`` instead [3]_
|
* The ``<>`` operator: use ``!=`` instead [3]_
|
||||||
* Unbound methods [7]_
|
* Unbound methods [7]_
|
||||||
|
* METH_OLDARGS
|
||||||
|
* __getslice__, __setslice__, __delslice__ [17]_
|
||||||
|
* C APIs (see code):
|
||||||
|
PyFloat_AsString, PyFloat_AsReprString, PyFloat_AsStringEx,
|
||||||
|
PySequence_In, PyEval_EvalFrame, PyEval_CallObject,
|
||||||
|
_PyObject_Del, _PyObject_GC_Del, _PyObject_GC_Track, _PyObject_GC_UnTrack
|
||||||
|
|
||||||
|
|
||||||
Built-in Namespace
|
Built-in Namespace
|
||||||
|
@ -82,6 +95,7 @@ Built-in Namespace
|
||||||
* Introduce ``trunc()``, which would call the ``__trunc__()`` method on its
|
* Introduce ``trunc()``, which would call the ``__trunc__()`` method on its
|
||||||
argument; suggested use is for objects like float where calling ``__int__()``
|
argument; suggested use is for objects like float where calling ``__int__()``
|
||||||
has data loss, but an integral representation is still desired [8]_
|
has data loss, but an integral representation is still desired [8]_
|
||||||
|
* Exception hierarchy changes [20]_
|
||||||
|
|
||||||
To be removed:
|
To be removed:
|
||||||
|
|
||||||
|
@ -106,18 +120,41 @@ To be removed:
|
||||||
|
|
||||||
* ``basestring.find()`` and ``basestring.rfind()``; use ``basestring.index()``
|
* ``basestring.find()`` and ``basestring.rfind()``; use ``basestring.index()``
|
||||||
or ``basestring.rindex()`` in a try/except block [15]_
|
or ``basestring.rindex()`` in a try/except block [15]_
|
||||||
|
* ``file.xreadlines()`` method [17]_
|
||||||
|
|
||||||
|
|
||||||
Standard library
|
Standard library
|
||||||
================
|
================
|
||||||
|
|
||||||
* Reorganize the standard library to not be as shallow
|
* Reorganize the standard library to not be as shallow
|
||||||
|
* Move test code to where it belongs, there will be no more test() functions
|
||||||
|
in the standard library
|
||||||
|
|
||||||
To be removed:
|
To be removed:
|
||||||
|
|
||||||
* ``string`` and other deprecated modules [1]_
|
* Deprecated modules, methods, parameters, attributes, etc. [1]_ [17]_ [18]_
|
||||||
* ``sys.exc_type``: not thread-safe; use ``sys.exc_info`` [2]_
|
There may be other modules, the most common are listed below.
|
||||||
|
|
||||||
|
stdlib modules to be removed (see docstrings and comments in the source):
|
||||||
|
* ``macfs``, ``new``, ``reconvert``, ``stringold``, ``xmllib``
|
||||||
|
* ``pcre``, ``pypcre``, ``strop``
|
||||||
|
stdlib modules to be removed (see PEP 4): [18]_
|
||||||
|
* ``posixfile``, ``pre``, ``regsub``, ``rfc822``,
|
||||||
|
* ``statcache``, ``string``, ``TERMIOS``
|
||||||
|
* ``mimetools``, ``MimeWriter``, ``mimify``,
|
||||||
|
* ``mpz``, ``rgbimage``
|
||||||
|
* Everything in lib-old: [18]_
|
||||||
|
* Para.py, addpack.py, cmp.py, cmpcache.py, codehack.py,
|
||||||
|
* dircmp.py, dump.py, find.py, fmt.py, grep.py, lockfile.py,
|
||||||
|
* newdir.py, ni.py, packmail.py, poly.py, rand.py, statcache.py,
|
||||||
|
* tb.py, tzparse.py, util.py, whatsound.py, whrandom.py, zmod.py
|
||||||
|
|
||||||
|
* ``sys.exitfunc``: use atexit module instead [17]_
|
||||||
|
* ``sys.exc_type``, ``sys.exc_values``, ``sys.exc_traceback``:
|
||||||
|
not thread-safe; use ``sys.exc_info()`` or an attribute
|
||||||
|
of the exception [2]_ [13]_ [17]_
|
||||||
|
* ``array.read``, ``array.write`` [17]_
|
||||||
|
* ``operator.isCallable``, ``operator.sequenceIncludes`` [17]_
|
||||||
|
|
||||||
References
|
References
|
||||||
==========
|
==========
|
||||||
|
@ -171,6 +208,21 @@ References
|
||||||
.. [16] python-dev email (Replacement for print in Python 3.0)
|
.. [16] python-dev email (Replacement for print in Python 3.0)
|
||||||
http://mail.python.org/pipermail/python-dev/2005-September/056154.html
|
http://mail.python.org/pipermail/python-dev/2005-September/056154.html
|
||||||
|
|
||||||
|
.. [17] Python docs
|
||||||
|
http://docs.python.org/ref/sequence-methods.html
|
||||||
|
http://docs.python.org/lib/module-sys.html
|
||||||
|
http://docs.python.org/lib/module-operator.html
|
||||||
|
http://docs.python.org/lib/module-array.html
|
||||||
|
http://docs.python.org/lib/bltin-file-objects.html
|
||||||
|
|
||||||
|
.. [18] PEP 4 ("Deprecation of Standard Modules")
|
||||||
|
http://www.python.org/peps/pep-0004.html
|
||||||
|
|
||||||
|
.. [19] PEP 328 ("Imports: Multi-Line and Absolute/Relative")
|
||||||
|
http://www.python.org/peps/pep-0328.html
|
||||||
|
|
||||||
|
.. [20] PEP 352 ("Required Superclass for Exceptions")
|
||||||
|
http://www.python.org/peps/pep-0352.html
|
||||||
|
|
||||||
Copyright
|
Copyright
|
||||||
=========
|
=========
|
||||||
|
|
Loading…
Reference in New Issue