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:
Jeremy Hylton 2001-08-12 21:53:08 +00:00
parent 910d7d46dc
commit 39f77bc90e
1 changed files with 3 additions and 0 deletions

View File

@ -416,6 +416,9 @@ class _Set:
del data[x]
return result
def __iter__(self):
return iter(self.data)
def tolist(self, sorted=1):
"Return _Set elements as a list."
data = self.data.keys()