diff options
author | Raymond Hettinger <python@rcn.com> | 2010-08-22 07:56:20 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2010-08-22 07:56:20 (GMT) |
commit | 0e708a1b79d644f313111ec02c9e9be500b3754f (patch) | |
tree | 2f5d44afb747c09502e0e89dd37939f0668e9874 /Lib/_abcoll.py | |
parent | d5c190d20863148a0ee3550bbd5d902c32910120 (diff) | |
download | cpython-0e708a1b79d644f313111ec02c9e9be500b3754f.zip cpython-0e708a1b79d644f313111ec02c9e9be500b3754f.tar.gz cpython-0e708a1b79d644f313111ec02c9e9be500b3754f.tar.bz2 |
Issue #9214: Fix set operations on KeysView and ItemsView.
Diffstat (limited to 'Lib/_abcoll.py')
-rw-r--r-- | Lib/_abcoll.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py index 7890e97..d3e23c1 100644 --- a/Lib/_abcoll.py +++ b/Lib/_abcoll.py @@ -393,6 +393,10 @@ class MappingView(Sized): class KeysView(MappingView, Set): + @classmethod + def _from_iterable(self, it): + return set(it) + def __contains__(self, key): return key in self._mapping @@ -405,6 +409,10 @@ KeysView.register(dict_keys) class ItemsView(MappingView, Set): + @classmethod + def _from_iterable(self, it): + return set(it) + def __contains__(self, item): key, value = item try: |