Commit e5614630 authored by Tim Peters's avatar Tim Peters

Move one of the tests into the "PEP 255" section, to reflect a change in

the PEP.
parent e578a638
...@@ -137,6 +137,21 @@ Generators can call other generators: ...@@ -137,6 +137,21 @@ Generators can call other generators:
pep_tests = """ pep_tests = """
Specification: Yield
Restriction: A generator cannot be resumed while it is actively
running:
>>> def g():
... i = me.next()
... yield i
>>> me = g()
>>> me.next()
Traceback (most recent call last):
...
File "<string>", line 2, in g
ValueError: generator already executing
Specification: Return Specification: Return
Note that return isn't always equivalent to raising StopIteration: the Note that return isn't always equivalent to raising StopIteration: the
...@@ -310,18 +325,6 @@ in try/except, not like a return. ...@@ -310,18 +325,6 @@ in try/except, not like a return.
>>> list(g()) >>> list(g())
[1, 2, 3] [1, 2, 3]
A generator can't be resumed while it's already running.
>>> def g():
... i = me.next()
... yield i
>>> me = g()
>>> me.next()
Traceback (most recent call last):
...
File "<string>", line 2, in g
ValueError: generator already executing
Next one was posted to c.l.py. Next one was posted to c.l.py.
>>> def gcomb(x, k): >>> def gcomb(x, k):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment