[issue26973] Dict View binops permit non-set types

Joshua Morton report at bugs.python.org
Sun May 8 00:24:59 EDT 2016


New submission from Joshua Morton:

Following the comments in python ideas [1], I'm submitting a bug report. In python 3, dictionary views (KeysView and ItemsView specifically) do not adhere to the same interface as Sets. Specifically, the __and__, __or__, __xor__, and __sub__ methods on Views will accept a non-set type (`{}.keys() | []`), while the same throws a TypeError on a Set. The suggested, not-backwards-compatible solution, was to have dictviews raise errors in the same way. 

[1] https://mail.python.org/pipermail/python-ideas/2016-April/039469.html

----------
messages: 265110
nosy: Joshua Morton
priority: normal
severity: normal
status: open
title: Dict View binops permit non-set types
type: behavior
versions: Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26973>
_______________________________________


More information about the Python-bugs-list mailing list