[Python-ideas] Hooks into the IO system to intercept raw file reads/writes
Victor Stinner
victor.stinner at gmail.com
Tue Feb 10 15:04:22 CET 2015
2015-02-10 14:56 GMT+01:00 Paul Moore <p.f.moore at gmail.com>:
> On 10 February 2015 at 13:42, Victor Stinner <victor.stinner at gmail.com> wrote:
>> Maybe I should repeat the information somewhere else in the documentation?
>
> Not many of the code samples seem to include loop.close().
Which code samples? I tried to ensure that all code snippets in
asyncio doc and all examples in Tulip repository call loop.close().
> Maybe they should?
Yes.
> For example, if I have a loop.run_forever() call, should it be
> enclosed in try: ... finally: loop.close() to ensure the loop is
> closed?
"loop.run_forever(); loop.close()" should be fine. You may use
try/finally if you don't want to register signal handlers for
SIGINT/SIGTERM (which is not supported on Windows yet...).
Victor
More information about the Python-ideas
mailing list