ID EN
Sys

set_asyncgen_hooks

Python 3.11

Accepts two optional keyword arguments which are callables that accept an asynchronous generator iterator as an argument. The firstiter callable will be called when an asynchronous generator is iterated for the first time. The finalizer will be called when an asynchronous generator is about to be garbage collected.

Syntax

PYTHON
sys.set_asyncgen_hooks([firstiter] [, finalizer])

See Also

asynchronous generator iterator auditing event auditing event