mirror of https://github.com/jab/bidict.git
docs tweaks
This commit is contained in:
parent
c6831d888b
commit
c990197122
|
@ -137,10 +137,10 @@ Subclassing :func:`~collections.namedtuple` classes
|
||||||
|
|
||||||
To get the performance benefits, intrinsic sortability, etc.
|
To get the performance benefits, intrinsic sortability, etc.
|
||||||
of :func:`~collections.namedtuple`
|
of :func:`~collections.namedtuple`
|
||||||
but customize behavior, state, API, etc.,
|
while customizing behavior, state, API, etc.,
|
||||||
you can subclass a :func:`~collections.namedtuple`-created class.
|
you can subclass a :func:`~collections.namedtuple` class.
|
||||||
Just make sure to include ``__slots__ = ()``
|
Just make sure to include ``__slots__ = ()``,
|
||||||
or you'll lose some of the performance benefits.
|
or you'll lose a lot of the performance benefits.
|
||||||
|
|
||||||
``_marker.py`` contains a small example.
|
``_marker.py`` contains a small example.
|
||||||
Here's a larger one:
|
Here's a larger one:
|
||||||
|
|
|
@ -24,12 +24,12 @@ by adding the
|
||||||
:obj:`~abc.abstractproperty`. [#fn-subclasshook]_
|
:obj:`~abc.abstractproperty`. [#fn-subclasshook]_
|
||||||
|
|
||||||
.. [#fn-subclasshook]
|
.. [#fn-subclasshook]
|
||||||
(In fact, any :class:`collections.abc.Mapping`
|
In fact, any :class:`collections.abc.Mapping`
|
||||||
that provides an ``inv`` attribute
|
that provides an ``inv`` attribute
|
||||||
will be considered a virtual subclass of
|
will be considered a virtual subclass of
|
||||||
:class:`bidict.BidirectionalMapping`
|
:class:`bidict.BidirectionalMapping`
|
||||||
:meth:`automatically <bidict.BidirectionalMapping.__subclasshook__>`,
|
:meth:`automatically <bidict.BidirectionalMapping.__subclasshook__>`,
|
||||||
enabling interoperability with external implementations.)
|
enabling interoperability with external implementations.
|
||||||
|
|
||||||
As you may have noticed,
|
As you may have noticed,
|
||||||
:class:`bidict.bidict` is also
|
:class:`bidict.bidict` is also
|
||||||
|
|
Loading…
Reference in New Issue