diff options
author | Raymond Hettinger <python@rcn.com> | 2011-01-18 00:19:30 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2011-01-18 00:19:30 (GMT) |
commit | 7ec790d1fa543166fcc5cd0036dc7c4e4fdc120a (patch) | |
tree | 1d94616a4f9691e9502512f5da33b59d3a090277 /Doc | |
parent | ca904be778f870f41cf404e49ecd52f0f13b6348 (diff) | |
download | cpython-7ec790d1fa543166fcc5cd0036dc7c4e4fdc120a.zip cpython-7ec790d1fa543166fcc5cd0036dc7c4e4fdc120a.tar.gz cpython-7ec790d1fa543166fcc5cd0036dc7c4e4fdc120a.tar.bz2 |
Add example for the abc module.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/whatsnew/3.2.rst | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst index 11f325a..2a9104d 100644 --- a/Doc/whatsnew/3.2.rst +++ b/Doc/whatsnew/3.2.rst @@ -815,9 +815,9 @@ collections (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 @@ abc 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`.) |