summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-02-08 23:02:27 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-02-08 23:02:27 (GMT)
commit18a1ffcda373fad5f60c187217d7c2125bccf005 (patch)
tree6e78866a38a40ee72472fc0a14f698ae94e8f1ef
parent0913166da2629a567c7acdb70511a1b2347000fb (diff)
downloadcpython-18a1ffcda373fad5f60c187217d7c2125bccf005.zip
cpython-18a1ffcda373fad5f60c187217d7c2125bccf005.tar.gz
cpython-18a1ffcda373fad5f60c187217d7c2125bccf005.tar.bz2
Speed-up __iter__() mixin method.
-rw-r--r--Lib/_abcoll.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py
index 6c27e66..30ec7d4 100644
--- a/Lib/_abcoll.py
+++ b/Lib/_abcoll.py
@@ -496,13 +496,13 @@ class Sequence:
def __iter__(self):
i = 0
- while True:
- try:
+ try:
+ while True:
v = self[i]
- except IndexError:
- break
- yield v
- i += 1
+ yield v
+ i += 1
+ except IndexError:
+ return
def __contains__(self, value):
for v in self: