[issue32467] dict_values isn't considered a Collection nor a Container

Raymond Hettinger report at bugs.python.org
Thu Jan 11 03:35:05 EST 2018


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

It would be okay to let ValuesView inherit from Collection.

Am marking this a 3.7 only because it isn't important to anyone's actual code and there is no known use case.  Technically, it isn't even a bug.  The __contains__ method is supported implicitly (as it is for many classes that just define __iter__), so there is no requirement that this be recognized as a Collection.  Also, the existing behavior was explicitly tested (see line 848 in Lib/test/test_collections).

I'm going forward with this because it does offer a sense of neatness (in comparison to KeysView and ItemsView) and it might avoid a pedantic StackOverflow question somewhere down the line.

----------
assignee:  -> rhettinger
components: +Library (Lib)
nosy: +rhettinger
priority: normal -> low
versions:  -Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32467>
_______________________________________


More information about the Python-bugs-list mailing list