2002-06-06 15:25:31 -04:00
|
|
|
|
PEP: 291
|
|
|
|
|
Title: Backward Compatibility for Standard Library
|
|
|
|
|
Version: $Revision$
|
|
|
|
|
Last-Modified: $Date$
|
2006-02-08 00:53:43 -05:00
|
|
|
|
Author: nnorwitz@gmail.com (Neal Norwitz)
|
2002-06-06 15:25:31 -04:00
|
|
|
|
Status: Active
|
|
|
|
|
Type: Informational
|
|
|
|
|
Created: 06-Jun-2002
|
|
|
|
|
Python-Version: 2.3
|
2007-06-19 00:20:07 -04:00
|
|
|
|
Post-History:
|
2002-06-06 15:25:31 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Abstract
|
|
|
|
|
|
|
|
|
|
This PEP describes the packages and modules in the standard
|
|
|
|
|
library which should remain backward compatible with previous
|
2003-12-04 10:12:55 -05:00
|
|
|
|
versions of Python. If a package is not listed here, then it need
|
|
|
|
|
only remain compatible with the version of Python it is
|
|
|
|
|
distributed with.
|
2002-06-06 15:25:31 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rationale
|
|
|
|
|
|
|
|
|
|
Authors have various reasons why packages and modules should
|
|
|
|
|
continue to work with previous versions of Python. In order to
|
|
|
|
|
maintain backward compatibility for these modules while moving the
|
|
|
|
|
rest of the standard library forward, it is necessary to know
|
|
|
|
|
which modules can be modified and which should use old and
|
|
|
|
|
possibly deprecated features.
|
|
|
|
|
|
|
|
|
|
Generally, authors should attempt to keep changes backward
|
|
|
|
|
compatible with the previous released version of Python in order
|
|
|
|
|
to make bug fixes easier to backport.
|
|
|
|
|
|
2002-11-15 17:53:27 -05:00
|
|
|
|
In addition to a package or module being listed in this PEP,
|
|
|
|
|
authors must add a comment at the top of each file documenting
|
|
|
|
|
the compatibility requirement.
|
|
|
|
|
|
2006-02-22 17:02:13 -05:00
|
|
|
|
When a major version of Python is released, a Subversion branch is
|
2003-12-04 10:12:55 -05:00
|
|
|
|
created for continued maintenance and bug fix releases. A package
|
|
|
|
|
version on a branch may have a different compatibility requirement
|
|
|
|
|
than the same package on the trunk (i.e. current bleeding-edge
|
|
|
|
|
development). Where appropriate, these branch compatibilities are
|
|
|
|
|
listed below.
|
|
|
|
|
|
2002-06-06 15:25:31 -04:00
|
|
|
|
|
|
|
|
|
Features to Avoid
|
|
|
|
|
|
|
|
|
|
The following list contains common features to avoid in order
|
|
|
|
|
to maintain backward compatibility with each version of Python.
|
|
|
|
|
This list is not complete! It is only meant as a general guide.
|
|
|
|
|
|
2002-11-29 20:50:39 -05:00
|
|
|
|
Note that the features below were implemented in the version
|
|
|
|
|
following the one listed. For example, features listed next to
|
|
|
|
|
1.5.2 were implemented in 2.0.
|
2002-06-06 15:25:31 -04:00
|
|
|
|
|
2002-11-29 20:50:39 -05:00
|
|
|
|
Version Features to Avoid
|
|
|
|
|
------- -----------------
|
2002-06-06 15:25:31 -04:00
|
|
|
|
1.5.2 string methods, Unicode, list comprehensions,
|
|
|
|
|
augmented assignment (eg, +=), zip(), import x as y,
|
2005-12-11 18:33:53 -05:00
|
|
|
|
dict.setdefault(), print >> f,
|
2006-06-17 11:50:49 -04:00
|
|
|
|
calling f(*args, **kw), plus all features below
|
2002-06-06 15:25:31 -04:00
|
|
|
|
|
2005-12-11 18:33:53 -05:00
|
|
|
|
2.0 nested scopes, rich comparisons,
|
2006-06-17 11:50:49 -04:00
|
|
|
|
function attributes, plus all features below
|
2002-06-06 15:25:31 -04:00
|
|
|
|
|
|
|
|
|
2.1 use of object or new-style classes, iterators,
|
|
|
|
|
using generators, nested scopes, or //
|
|
|
|
|
without from __future__ import ... statement,
|
2006-10-06 09:13:57 -04:00
|
|
|
|
isinstance(X, TYP) where TYP is a tuple of types,
|
2002-11-29 20:50:39 -05:00
|
|
|
|
plus all features below
|
2002-06-06 15:25:31 -04:00
|
|
|
|
|
2005-12-11 18:33:53 -05:00
|
|
|
|
2.2 bool, True, False, basestring, enumerate(),
|
2006-06-17 11:50:49 -04:00
|
|
|
|
{}.pop(), PendingDeprecationWarning,
|
|
|
|
|
Universal Newlines, plus all features below
|
2006-06-30 02:30:07 -04:00
|
|
|
|
plus all features below
|
2005-12-11 18:33:53 -05:00
|
|
|
|
|
2006-06-17 11:50:49 -04:00
|
|
|
|
2.3 generator expressions, multi-line imports,
|
|
|
|
|
decorators, int/long unification, set/frozenset,
|
2006-06-30 02:30:07 -04:00
|
|
|
|
reversed(), sorted(), "".rsplit(),
|
|
|
|
|
plus all features below
|
|
|
|
|
|
|
|
|
|
2.4 with statement, conditional expressions,
|
|
|
|
|
combined try/except/finally, relative imports,
|
|
|
|
|
yield expressions or generator.throw/send/close()
|
2002-06-06 15:25:31 -04:00
|
|
|
|
|
2006-06-30 02:30:07 -04:00
|
|
|
|
2.5 ???
|
2006-04-29 08:21:13 -04:00
|
|
|
|
|
2002-06-06 15:25:31 -04:00
|
|
|
|
|
|
|
|
|
Backward Compatible Packages, Modules, and Tools
|
|
|
|
|
|
2003-12-04 10:12:55 -05:00
|
|
|
|
Package/Module Maintainer(s) Python Version Notes
|
|
|
|
|
-------------- ------------- -------------- -----
|
2003-12-04 10:16:00 -05:00
|
|
|
|
bsddb Greg Smith 2.1
|
|
|
|
|
Barry Warsaw
|
2002-06-06 15:25:31 -04:00
|
|
|
|
compiler Jeremy Hylton 2.1
|
2006-04-18 00:32:36 -04:00
|
|
|
|
ctypes Thomas Heller 2.3
|
2004-08-19 18:58:30 -04:00
|
|
|
|
decimal Raymond Hettinger 2.3 [2]
|
2009-02-27 08:05:47 -05:00
|
|
|
|
distutils Tarek Ziade 2.3
|
2003-12-04 10:12:55 -05:00
|
|
|
|
email Barry Warsaw 2.1 / 2.3 [1]
|
2002-11-15 17:53:27 -05:00
|
|
|
|
logging Vinay Sajip 1.5.2
|
2006-04-18 00:32:36 -04:00
|
|
|
|
modulefinder Thomas Heller 2.2
|
|
|
|
|
Just van Rossum
|
2006-04-18 00:26:58 -04:00
|
|
|
|
pkgutil Phillip Eby 2.3
|
2006-04-18 00:32:36 -04:00
|
|
|
|
platform Marc-Andre Lemburg 1.5.2
|
2006-04-29 08:21:13 -04:00
|
|
|
|
pybench Marc-Andre Lemburg 1.5.2 [3]
|
2003-07-02 17:07:42 -04:00
|
|
|
|
sre Fredrik Lundh 2.1
|
2004-10-13 11:57:42 -04:00
|
|
|
|
subprocess Peter Astrand 2.2
|
2006-06-09 21:41:25 -04:00
|
|
|
|
wsgiref Phillip J. Eby 2.1
|
2002-06-06 15:25:31 -04:00
|
|
|
|
xml (PyXML) Martin v. Loewis 2.0
|
2004-08-20 03:32:06 -04:00
|
|
|
|
xmlrpclib Fredrik Lundh 2.1
|
2002-06-06 15:25:31 -04:00
|
|
|
|
|
|
|
|
|
Tool Maintainer(s) Python Version
|
|
|
|
|
---- ------------- --------------
|
2002-11-15 17:53:27 -05:00
|
|
|
|
None
|
2002-06-06 15:25:31 -04:00
|
|
|
|
|
|
|
|
|
|
2003-12-04 10:12:55 -05:00
|
|
|
|
Notes
|
|
|
|
|
-----
|
|
|
|
|
|
|
|
|
|
[1] The email package version 2 was distributed with Python up to
|
|
|
|
|
Python 2.3, and this must remain Python 2.1 compatible. email
|
|
|
|
|
package version 3 will be distributed with Python 2.4 and will
|
|
|
|
|
need to remain compatible only with Python 2.3.
|
|
|
|
|
|
2004-08-19 18:58:30 -04:00
|
|
|
|
[2] Specification updates will be treated as bugfixes and backported.
|
|
|
|
|
Python 2.3 compatibility will be kept for at least Python 2.4.
|
|
|
|
|
The decision will be revisited for Python 2.5 and not changed
|
|
|
|
|
unless compelling advantages arise.
|
|
|
|
|
|
2006-04-29 08:21:13 -04:00
|
|
|
|
[3] pybench lives under the Tools/ directory. Compatibility with
|
2006-05-23 08:38:51 -04:00
|
|
|
|
older Python versions is needed in order to be able to compare
|
2006-04-29 08:21:13 -04:00
|
|
|
|
performance between Python versions. New features may still
|
|
|
|
|
be used in new tests, which may then be configured to fail
|
|
|
|
|
gracefully on import by the tool in older Python versions.
|
|
|
|
|
|
2003-12-04 10:12:55 -05:00
|
|
|
|
|
2002-06-06 15:25:31 -04:00
|
|
|
|
Copyright
|
|
|
|
|
|
|
|
|
|
This document has been placed in the public domain.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Local Variables:
|
|
|
|
|
mode: indented-text
|
|
|
|
|
indent-tabs-mode: nil
|
|
|
|
|
sentence-end-double-space: t
|
|
|
|
|
fill-column: 70
|
|
|
|
|
End:
|