summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2010-04-11 12:49:37 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2010-04-11 12:49:37 (GMT)
commit6d7dfa231f362b06a94dec259c187cd7a6097f6d (patch)
tree28beca8cbe932510140a9c2f4912a97954b13401
parent884d0a3c2743e1355c33524ad8986b6fb90e6763 (diff)
downloadcpython-6d7dfa231f362b06a94dec259c187cd7a6097f6d.zip
cpython-6d7dfa231f362b06a94dec259c187cd7a6097f6d.tar.gz
cpython-6d7dfa231f362b06a94dec259c187cd7a6097f6d.tar.bz2
Add two items
-rw-r--r--Doc/whatsnew/2.7.rst27
1 files changed, 23 insertions, 4 deletions
diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst
index 560ec23..69b240c 100644
--- a/Doc/whatsnew/2.7.rst
+++ b/Doc/whatsnew/2.7.rst
@@ -10,6 +10,7 @@
.. Big jobs: argparse, ElementTree 1.3, pep 391, 3106, sysconfig
.. unittest test discovery
+.. hyperlink all the methods & functions.
.. $Id$
Rules for maintenance:
@@ -717,10 +718,13 @@ changes, or look through the Subversion logs for all the details.
(Added by Raymond Hettinger; :issue:`1818`.)
- The :class:`~collections.deque` data type now exposes its maximum length as the
- read-only :attr:`~collections.deque.maxlen` attribute, and has a
- :meth:`~collections.deque.reverse` method that reverses the elements of the deque in-place.
- (Added by Raymond Hettinger.)
+ The :class:`~collections.deque` data type now has a
+ :meth:`~collections.deque.count` method that returns the number of
+ contained elements equal to the supplied argument *x*, and a
+ :meth:`~collections.deque.reverse` method that reverses the elements
+ of the deque in-place. :class:`deque` also exposes its maximum
+ length as the read-only :attr:`~collections.deque.maxlen` attribute.
+ (Both features added by Raymond Hettinger.)
* The :mod:`copy` module's :func:`~copy.deepcopy` function will now
correctly copy bound instance methods. (Implemented by
@@ -782,6 +786,21 @@ changes, or look through the Subversion logs for all the details.
uploads thanks to an added *rest* parameter (patch by Pablo Mouzo;
:issue:`6845`.)
+* New class decorator: :func:`total_ordering` in the :mod:`functools`
+ module takes a class that defines an :meth:`__eq__` method and one of
+ :meth:`__lt__`, :meth:`__le__`, :meth:`__gt__`, or :meth:`__ge__`,
+ and generates the missing comparison methods. Since the
+ :meth:`__cmp__` method is being deprecated in Python 3.x,
+ this decorator makes it easier to define ordered classes.
+ (Added by Raymond Hettinger; :issue:`5479`.)
+
+ New function: :func:`cmp_to_key` will take an old-style comparison
+ function that expects two arguments and return a new callable that
+ can be used as the *key* parameter to functions such as
+ :func:`sorted`, :func:`min` and :func:`max`, etc. The primary
+ intended use is to help with making code compatible with Python 3.x.
+ (Added by Raymond Hettinger.)
+
* New function: the :mod:`gc` module's :func:`~gc.is_tracked` returns
true if a given instance is tracked by the garbage collector, false
otherwise. (Contributed by Antoine Pitrou; :issue:`4688`.)