Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ec790d

Browse files
committed
Add example for the abc module.
1 parent ca904be commit 7ec790d

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

Doc/whatsnew/3.2.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -815,9 +815,9 @@ collections
815815

816816
(Contributed by Raymond Hettinger.)
817817

818-
* The :class:`collections.deque` grew two new methods :meth:`~collections.deque.count`
819-
and :meth:`collections.deque.reverse` that make them more substitutable for
820-
:class:`list` when needed:
818+
* The :class:`collections.deque` class grew two new methods
819+
:meth:`~collections.deque.count` and :meth:`~collections.deque.reverse` that
820+
make them more substitutable for :class:`list` objects:
821821

822822
>>> d = deque('simsalabim')
823823
>>> d.count('s')
@@ -914,9 +914,17 @@ abc
914914
The :mod:`abc` module now supports :func:`~abc.abstractclassmethod` and
915915
:func:`~abc.abstractstaticmethod`.
916916

917-
These tools make it possible to define an :term:`Abstract Base Class` that
917+
These tools make it possible to define an :term:`abstract base class` that
918918
requires a particular :func:`classmethod` or :func:`staticmethod` to be
919-
implemented.
919+
implemented::
920+
921+
class Temperature(metaclass=ABCMeta):
922+
@abc.abstractclassmethod
923+
def from_farenheit(self, t):
924+
...
925+
@abc.abstractclassmethod
926+
def from_celsium(self, t):
927+
...
920928

921929
(Patch submitted by Daniel Urban; :issue:`5867`.)
922930

0 commit comments

Comments
 (0)