Lines Matching defs:generator
20 # generator (see bpo-30039).
51 # A generator frame can be resurrected by a generator's finalization.
70 # A generator caught in a refcycle gets finalized anyway.
92 # Issue #23192: Test that a lambda returning a generator behaves
118 # check generator names
124 # modify generator names
130 # generator names must be a string and cannot be deleted
136 # modify names of the function creating the generator
143 # unnamed generator
355 def generator():
359 gen = generator()
375 # Raise StopIteration" stops the generator too:
427 # Check that the context is also available from inside the generator
586 [] = gen_b # Exhaust generator
592 Let's try a simple generator:
608 "Falling off the end" stops the generator:
616 "return" also stops the generator:
666 Let's create an alternate range() function implemented as a generator:
711 Restriction: A generator cannot be resumed while it is actively
722 ValueError: generator already executing
765 >>> next(k) # and the generator cannot be resumed
831 >>> # A recursive generator that generates Tree labels in in-order.
847 >>> # A non-recursive generator.
863 >>> # Exercise the non-recursive generator.
954 <class 'generator'>
975 AttributeError: attribute 'gi_running' of 'generator' objects is not writable
995 ... self.generator = self.generate()
1000 ... for x in self.parent.generator:
1004 ... return next(self.generator)
1065 Build up to a recursive Sieve of Eratosthenes generator.
1127 generator. Note that me_times2 (etc) each need to see every element in the
1159 arguments are iterable -- a LazyList is the same as a generator to times().
1195 Ye olde Fibonacci generator, LazyList style.
1238 therefore continually grows. This partially defeats the goal of the generator
1243 m235 to share a single generator".
1274 Ye olde Fibonacci generator, tee style.
1346 <class 'generator'>
1353 <class 'generator'>
1360 <class 'generator'>
1366 <class 'generator'>
1390 <class 'generator'>
1416 <class 'generator'>
1465 '<generator object f at ...>'
1478 # conjoin is a simple backtracking generator, named in honor of Icon's
1515 # generator boundaries, it's possible to eliminate most of that overhead.
1517 # a core building block for some CPU-intensive generator applications.
2036 Sending a value into a started generator:
2048 Sending a value into a new generator produces a TypeError:
2053 TypeError: can't send non-None value to a just-started generator
2063 Yield is allowed only in the outermost iterable in generator expression:
2067 <class 'generator'>
2179 >>> throw(g,TypeError) # terminate the generator
2192 >>> g.throw(ValueError,6) # throw on closed generator
2197 >>> f().throw(ValueError,7) # throw on just-opened generator
2202 Plain "raise" inside a generator should preserve the traceback (#13188).
2228 Now let's try closing a generator:
2241 >>> f().close() # close on just-opened generator should be fine
2243 >>> def f(): yield # an even simpler generator
2288 RuntimeError: generator ignored GeneratorExit
2300 ... "generator ignored GeneratorExit" in str(cm.unraisable.exc_value)
2321 enclosing function a generator:
2325 <class 'generator'>
2329 <class 'generator'>
2333 <class 'generator'>
2339 <class 'generator'>
2380 This test leaked at one point due to generator finalization/destruction.
2394 This test isn't really generator related, but rather exception-in-cleanup
2396 the generator's __del__ (tp_del) method. We can also test for this