Move one of the tests into the "PEP 255" section, to reflect a change in
authorTim Peters <tim.peters@gmail.com>
Wed, 15 Aug 2001 04:41:19 +0000 (04:41 +0000)
committerTim Peters <tim.peters@gmail.com>
Wed, 15 Aug 2001 04:41:19 +0000 (04:41 +0000)
the PEP.

Lib/test/test_generators.py

index 2476a275f9d94650ef2d2efa2fad0e241c1fb97b..41629d352741dfa9baadf29f0e79b6356c395d8e 100644 (file)
@@ -137,6 +137,21 @@ Generators can call other generators:
 
 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
 
     Note that return isn't always equivalent to raising StopIteration:  the
@@ -310,18 +325,6 @@ in try/except, not like a return.
 >>> list(g())
 [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.
 
 >>> def gcomb(x, k):