-------------------
- Drop support for Python 2
:ref:`as promised in v0.18.2 <changelog:0.18.2 (2019-09-08)>`.
The ``bidict.compat`` module has been pruned accordingly.
This makes bidict more efficient on Python 3
and enables further improvement to bidict in the future.
- Deprecate ``bidict.OVERWRITE`` and ``bidict.IGNORE``.
A :class:`UserWarning` will now be emitted if these are used.
:attr:`bidict.DROP_OLD` and :attr:`bidict.DROP_NEW` should be used instead.
- Rename ``DuplicationPolicy`` to :class:`~bidict.OnDupAction`
(and implement it via an :class:`~enum.Enum`).
An :class:`~bidict.OnDupAction` may be one of
:attr:`~bidict.RAISE`,
:attr:`~bidict.DROP_OLD`, or
:attr:`~bidict.DROP_NEW`.
- Expose the new :class:`~bidict.OnDup` class
to contain the three :class:`~bidict.OnDupAction`\s
that should be taken upon encountering
the three kinds of duplication that can occur
(*key*, *val*, *kv*).
- Provide the
:attr:`~bidict.ON_DUP_DEFAULT`,
:attr:`~bidict.ON_DUP_RAISE`, and
:attr:`~bidict.ON_DUP_DROP_OLD`
:class:`~bidict.OnDup` convenience instances.
- Deprecate the
``on_dup_key``, ``on_dup_val``, and ``on_dup_kv`` arguments
of :meth:`~bidict.MutableBidict.put` and :meth:`~bidict.MutableBidict.putall`.
A :class:`UserWarning` will now be emitted if these are used.
These have been subsumed by the new *on_dup* argument,
which takes an :class:`~bidict.OnDup` instance.
Use it like this: ``bi.put(1, 2, OnDup(key=RAISE, val=...))``.
Or pass one of the instances already provided,
such as :attr:`~bidict.ON_DUP_DROP_OLD`.
Or just don't pass an *on_dup* argument
to use the default value of :attr:`~bidict.ON_DUP_RAISE`.
The :ref:`basic-usage:Values Must Be Unique` docs
have been updated accordingly.
- Deprecate the
``on_dup_key``, ``on_dup_val``, and ``on_dup_kv``
:class:`~bidict.bidict` class attributes.
A :class:`UserWarning` will now be emitted if these are used.
These have been subsumed by the new
:attr:`~bidict.BidictBase.on_dup` class attribute,
which takes an :class:`~bidict.OnDup` instance.
See the updated :doc:`extending` docs for example usage.
- Improve the more efficient implementations of
``bidict.BidirectionalMapping.keys``,
``bidict.BidirectionalMapping.values``, and
``bidict.BidirectionalMapping.items``,
and now also provide a more efficient implementation of
``bidict.BidirectionalMapping.__iter__``
by delegating to backing :class:`dict`\s
in the bidict types for which this is possible.
- Move
:meth:`bidict.BidictBase.values` to
``bidict.BidirectionalMapping.values``,
since the implementation is generic.
- No longer use ``__all__`` in :mod:`bidict`'s ``__init__.py``.