From 872feef24b50eccf6206f928e4ff564f9ac2bd61 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 17 Jun 2024 10:32:38 -0400 Subject: [PATCH] Add note about using `@acm` as decorator in 3.10 --- tractor/_context.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tractor/_context.py b/tractor/_context.py index f5d9d69..3b29761 100644 --- a/tractor/_context.py +++ b/tractor/_context.py @@ -2399,7 +2399,11 @@ def mk_context( # |_ `return: TypeAlias`, # |_ `invalid_policy: str|Callable` ? # -[ ] prolly implement the `@acm` wrapper using -# a `contextlib.ContextDecorator`? +# a `contextlib.ContextDecorator`, i guess not if +# we don't need an `__aexit__` block right? +# |_ de hecho, @acm can already be used as a decorator as of 3.10 +# but i dunno how that's gonna play with `trio.Nursery.start[_soon]()` +# |_ https://docs.python.org/3/library/contextlib.html#using-a-context-manager-as-a-function-decorator # def context( func: Callable|None = None,