[Python-checkins] r88084 - python/branches/py3k/Doc/whatsnew/3.2.rst
raymond.hettinger
python-checkins at python.org
Tue Jan 18 01:19:30 CET 2011
Author: raymond.hettinger
Date: Tue Jan 18 01:19:30 2011
New Revision: 88084
Log:
Add example for the abc module.
Modified:
python/branches/py3k/Doc/whatsnew/3.2.rst
Modified: python/branches/py3k/Doc/whatsnew/3.2.rst
==============================================================================
--- python/branches/py3k/Doc/whatsnew/3.2.rst (original)
+++ python/branches/py3k/Doc/whatsnew/3.2.rst Tue Jan 18 01:19:30 2011
@@ -815,9 +815,9 @@
(Contributed by Raymond Hettinger.)
-* The :class:`collections.deque` grew two new methods :meth:`~collections.deque.count`
- and :meth:`collections.deque.reverse` that make them more substitutable for
- :class:`list` when needed:
+* The :class:`collections.deque` class grew two new methods
+ :meth:`~collections.deque.count` and :meth:`~collections.deque.reverse` that
+ make them more substitutable for :class:`list` objects:
>>> d = deque('simsalabim')
>>> d.count('s')
@@ -914,9 +914,17 @@
The :mod:`abc` module now supports :func:`~abc.abstractclassmethod` and
:func:`~abc.abstractstaticmethod`.
-These tools make it possible to define an :term:`Abstract Base Class` that
+These tools make it possible to define an :term:`abstract base class` that
requires a particular :func:`classmethod` or :func:`staticmethod` to be
-implemented.
+implemented::
+
+ class Temperature(metaclass=ABCMeta):
+ @abc.abstractclassmethod
+ def from_farenheit(self, t):
+ ...
+ @abc.abstractclassmethod
+ def from_celsium(self, t):
+ ...
(Patch submitted by Daniel Urban; :issue:`5867`.)
More information about the Python-checkins
mailing list