[pypy-svn] r8829 - pypy/dist/pypy/lib
tismer at codespeak.net
tismer at codespeak.net
Thu Feb 3 16:18:29 CET 2005
Author: tismer
Date: Thu Feb 3 16:18:29 2005
New Revision: 8829
Modified:
pypy/dist/pypy/lib/_classobj.py
Log:
flow space cannot handle nested functions, so I changed this.
Modified: pypy/dist/pypy/lib/_classobj.py
==============================================================================
--- pypy/dist/pypy/lib/_classobj.py (original)
+++ pypy/dist/pypy/lib/_classobj.py Thu Feb 3 16:18:29 2005
@@ -79,6 +79,15 @@
return x.__dict__[name]
return None
+def seqiter(func): # XXX may want to access and instatiate the internal
+ # sequence-iterator type instead
+ i = 0
+ while 1:
+ try:
+ yield func(i)
+ except IndexError:
+ return
+ i += 1
class classobj(object):
@@ -463,16 +472,9 @@
func = instance_getattr1(self, '__getitem__')
if not func:
raise TypeError, "iteration over non-sequence"
- def seqiter(): # XXX may want to access and instatiate the internal
- # sequence-iterator type instead
- i = 0
- while 1:
- try:
- yield func(i)
- except IndexError:
- return
- i += 1
- return seqiter()
+ # moved sequiter away from here:
+ # flow space cannot handle nested functions.
+ return seqiter(func)
def next(self):
func = instance_getattr1(self, '__next__', False)
More information about the Pypy-commit
mailing list