bidict v0.13.0 Release Notes
Release Date: 2017-01-19 // over 7 years ago-
- 👌 Support Python 3.6.
(Earlier versions of bidict should work fine on 3.6, but it is officially supported starting in this version.)
- :class:
~bidict.BidirectionalMapping
has been refactored into an abstract base class, following the way :class:collections.abc.Mapping
works. The concrete method implementations it used to provide have been moved into a newBidictBase
subclass.
:class:
~bidict.BidirectionalMapping
now also implements :meth:~bidict.BidirectionalMapping.__subclasshook__
, so any class that provides a conforming set of attributes (enumerated in :attr:~bidict.BidirectionalMapping._subclsattrs
) will be considered a :class:~bidict.BidirectionalMapping
subclass automatically.OrderedBidirectionalMapping
has been renamed toOrderedBidictBase
, to better reflect its function. (It is not an ABC.)A new
FrozenBidictBase
class has been factored out of :class:~bidict.frozenbidict
and :class:frozenorderedbidict <bidict.FrozenOrderedBidict>
. This implements common behavior such as caching the result of__hash__
after the first call.The hash implementations of :class:
~bidict.frozenbidict
and :class:frozenorderedbidict <bidict.FrozenOrderedBidict>
. have been reworked to improve performance and flexibility. :class:frozenorderedbidict <bidict.FrozenOrderedBidict>
\’s hash implementation is now order-sensitive.
See
frozenbidict._compute_hash()
andfrozenorderedbidict._compute_hash
for more documentation of the changes, including the newfrozenbidict._USE_ITEMSVIEW_HASH
andfrozenorderedbidict._HASH_NITEMS_MAX
attributes. If you have an interesting use case that requires overriding these, or suggestions for an alternative implementation, pleaseshare your feedback <https://gitter.im/jab/bidict>
__.- Add
_fwd_class
and_inv_class
attributes representing the backing :class:~collections.abc.Mapping
types used internally to store the forward and inverse dictionaries, respectively.
This allows creating custom bidict types with extended functionality simply by overriding these attributes in a subclass.
See the new :doc:
extending
documentation for examples.Pass any parameters passed to :meth:
~bidict.bidict.popitem
through to_fwd.popitem
for greater extensibility.More concise repr strings for empty bidicts.
e.g.
bidict()
rather thanbidict({})
andorderedbidict()
rather thanorderedbidict([])
.- ➕ Add :attr:
bidict.compat.PYPY
and remove unusedbidict.compat.izip_longest
.