diff options
author | Raymond Hettinger <python@rcn.com> | 2010-08-22 08:01:58 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2010-08-22 08:01:58 (GMT) |
commit | 917bba1f2a382d5251b94eeadc344ec6ed3eaa97 (patch) | |
tree | dd89a8e06736c0618f0a3f26de8501790a2f059a /Lib/_abcoll.py | |
parent | 058981b2ec2d96d58aea3fc285fee062a32a5854 (diff) | |
download | cpython-917bba1f2a382d5251b94eeadc344ec6ed3eaa97.zip cpython-917bba1f2a382d5251b94eeadc344ec6ed3eaa97.tar.gz cpython-917bba1f2a382d5251b94eeadc344ec6ed3eaa97.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 a442d7c..e9234af 100644 --- a/Lib/_abcoll.py +++ b/Lib/_abcoll.py @@ -390,6 +390,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 @@ -400,6 +404,10 @@ class KeysView(MappingView, Set): class ItemsView(MappingView, Set): + @classmethod + def _from_iterable(self, it): + return set(it) + def __contains__(self, item): key, value = item try: |