Message405421
Hmm, I'm looking through the bidict code a bit more. Rather than saying the dict views are being used in an unsupported way, it is more accurate to say that your intended meaning for the *mapping* attribute differs from the published meaning.
Note, the implementation is already skating on thin ice. The values() call unexpectedly returns an instance of dict_keys(). At first, I was surprised that this got past the type checker -- you can do set operations with KeysView but not with a ValuesView.
>>> b.values()
dict_keys([1, 2])
One suggestion is to document *mapping* do exactly what it currently does. The mappingproxy means that you aren't promising a specific upstream implementation.
Also consider that bidict could guarantee the meaning of *mapping* and its underlying store. This would allow users to make fast conversions to other mapping types:
# This is weird, but useful.
# It might be nice to guarantee it.
>>> OrderedDict(b.values().mapping)
>>> OrderedDict([(1, 'a'), (2, 'b')]) |
|
Date |
User |
Action |
Args |
2021-10-31 21:43:50 | rhettinger | set | recipients:
+ rhettinger, jab |
2021-10-31 21:43:50 | rhettinger | set | messageid: <1635716630.5.0.0899439599112.issue45670@roundup.psfhosted.org> |
2021-10-31 21:43:50 | rhettinger | link | issue45670 messages |
2021-10-31 21:43:50 | rhettinger | create | |
|