This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients jab, rhettinger
Date 2021-10-31.21:43:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1635716630.5.0.0899439599112.issue45670@roundup.psfhosted.org>
In-reply-to
Content
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')])
History
Date User Action Args
2021-10-31 21:43:50rhettingersetrecipients: + rhettinger, jab
2021-10-31 21:43:50rhettingersetmessageid: <1635716630.5.0.0899439599112.issue45670@roundup.psfhosted.org>
2021-10-31 21:43:50rhettingerlinkissue45670 messages
2021-10-31 21:43:50rhettingercreate