On this page
types.GeneratorType
Prev: types.FunctionType | Up: types | Next: types.GenericAlias
Rel: types.AsyncGeneratorType, types.BuiltinFunctionType, types.BuiltinMethodType, types.CapsuleType
Ref: docs.python.org — types.GeneratorType
Tags: #public #python3 #stdlib #types
Import
import types
from types import GeneratorType
Signature & Overview
types.GeneratorType()
types.GeneratorType class.
Methods & Attributes
GeneratorType.close(self, /)— close() -> raise GeneratorExit inside generator.GeneratorType.send(self, object, /)— return next yielded value or raise StopIteration.GeneratorType.throw(...)— throw(type[,value[,tb]]) Raise exception in generator, return next yielded value or raise StopIteration.
Usage
import types
g = (x for x in range(3))
assert isinstance(g, types.GeneratorType)
Gotchas
- Type of generator functions and generator expressions.
REPL Inspect
from types import GeneratorType
help(GeneratorType)
Linked from
Related notes
- tuts/python3/stdlib_module/types/FunctionType Linked here; links to this page; shared tags: #stdlib, #types
- tuts/python3/stdlib_module/types/GenericAlias Linked here; links to this page; shared tags: #stdlib, #types
- tuts/python3/stdlib_module/types Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/types/AsyncGeneratorType Linked here; shared tags: #stdlib, #types
- tuts/python3/stdlib_module/types/BuiltinFunctionType Linked here; shared tags: #stdlib, #types
- tuts/python3/stdlib_module/types/BuiltinMethodType Linked here; shared tags: #stdlib, #types
- tuts/python3/stdlib_module/types/CapsuleType Linked here; shared tags: #stdlib, #types
- tuts/c/stdlib/stdint_stdbool_and_limits shared tags: #stdlib, #types
- tuts/python3/stdlib_module/types/CellType shared tags: #stdlib, #types
- tuts/python3/stdlib_module/types/ClassMethodDescriptorType shared tags: #stdlib, #types