mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Modify _Set to support iteration.
Otherwise printlist(surprise) will fail with a TypeError, because map is called with an argument that doesn't support iteration.
This commit is contained in:
parent
910d7d46dc
commit
39f77bc90e
1 changed files with 3 additions and 0 deletions
|
@ -416,6 +416,9 @@ class _Set:
|
||||||
del data[x]
|
del data[x]
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
return iter(self.data)
|
||||||
|
|
||||||
def tolist(self, sorted=1):
|
def tolist(self, sorted=1):
|
||||||
"Return _Set elements as a list."
|
"Return _Set elements as a list."
|
||||||
data = self.data.keys()
|
data = self.data.keys()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue