2018-01-02 21:49:34 +00:00
|
|
|
:class:`~bidict.frozenbidict`
|
squashed changes for 0.13.0
- support Python 3.6, refactor CI/test setup, increase test coverage
- refactor BidirectionalMapping, BidictBase, OrderedBidictBase,
FrozenBidictBase, and subclasses
- move frozenorderedbidict into _frozen and looseorderedbidict into _loose
- register bidict as a virtual subclass of MutableMapping rather than
inheriting from it directly. This makes it clearer that it does not use any
of the concrete generic methods that MutableMapping provides.
- improve performance and flexibility of frozenbidict and
frozenorderedbidict hashing
- docs, including new type-hierarchy.png diagram
- rm unused imap, ifilter, izip_longest from compat, add PYPY
- update to latest versions of dependencies
- restore benchmarking on travis
2017-01-09 15:37:31 +00:00
|
|
|
-------------------------------------------
|
2015-03-22 18:21:15 +00:00
|
|
|
|
|
|
|
As you would expect,
|
2017-11-20 03:24:08 +00:00
|
|
|
attempting to mutate a
|
2018-01-02 21:49:34 +00:00
|
|
|
:class:`~bidict.frozenbidict`
|
2017-11-20 03:24:08 +00:00
|
|
|
after initializing it causes an error::
|
2015-03-22 18:21:15 +00:00
|
|
|
|
2017-11-20 03:24:08 +00:00
|
|
|
>>> from bidict import frozenbidict
|
|
|
|
>>> f = frozenbidict({'H': 'hydrogen'})
|
2015-03-22 18:21:15 +00:00
|
|
|
>>> f['C'] = 'carbon'
|
|
|
|
Traceback (most recent call last):
|
2015-12-21 03:05:20 +00:00
|
|
|
...
|
2015-03-22 18:21:15 +00:00
|
|
|
TypeError...
|
|
|
|
|
2018-01-02 21:49:34 +00:00
|
|
|
:class:`~bidict.frozenbidict`
|
2017-11-20 03:24:08 +00:00
|
|
|
also implements :class:`collections.abc.Hashable`,
|
|
|
|
so it's suitable for insertion into sets or other mappings::
|
2015-03-22 18:21:15 +00:00
|
|
|
|
squashed changes for 0.13.0
- support Python 3.6, refactor CI/test setup, increase test coverage
- refactor BidirectionalMapping, BidictBase, OrderedBidictBase,
FrozenBidictBase, and subclasses
- move frozenorderedbidict into _frozen and looseorderedbidict into _loose
- register bidict as a virtual subclass of MutableMapping rather than
inheriting from it directly. This makes it clearer that it does not use any
of the concrete generic methods that MutableMapping provides.
- improve performance and flexibility of frozenbidict and
frozenorderedbidict hashing
- docs, including new type-hierarchy.png diagram
- rm unused imap, ifilter, izip_longest from compat, add PYPY
- update to latest versions of dependencies
- restore benchmarking on travis
2017-01-09 15:37:31 +00:00
|
|
|
>>> {f} is not 'an error'
|
2015-03-22 18:21:15 +00:00
|
|
|
True
|
squashed changes for 0.13.0
- support Python 3.6, refactor CI/test setup, increase test coverage
- refactor BidirectionalMapping, BidictBase, OrderedBidictBase,
FrozenBidictBase, and subclasses
- move frozenorderedbidict into _frozen and looseorderedbidict into _loose
- register bidict as a virtual subclass of MutableMapping rather than
inheriting from it directly. This makes it clearer that it does not use any
of the concrete generic methods that MutableMapping provides.
- improve performance and flexibility of frozenbidict and
frozenorderedbidict hashing
- docs, including new type-hierarchy.png diagram
- rm unused imap, ifilter, izip_longest from compat, add PYPY
- update to latest versions of dependencies
- restore benchmarking on travis
2017-01-09 15:37:31 +00:00
|
|
|
>>> {f: 1} is not 'an error'
|
|
|
|
True
|
|
|
|
|
2018-01-02 21:49:34 +00:00
|
|
|
See the :class:`~bidict.frozenbidict`
|
2017-11-20 03:24:08 +00:00
|
|
|
API documentation for more information.
|