classification
Title: @asynccontextmanager decorated functions are not callable like @contextmanager
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.9, Python 3.8, Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: fried, yselivanov
Priority: normal Keywords: patch

Created on 2019-10-08 20:45 by fried, last changed 2019-10-08 20:57 by fried.

Pull Requests
URL Status Linked Edit
PR 16667 open fried, 2019-10-08 20:57
Messages (1)
msg354232 - (view) Author: Jason Fried (fried) * Date: 2019-10-08 20:45
The standard contextmanager decorator produces a wrapper that itself can be used as a decorator

```
@contextmanager
def some_context():
    ...
    yield

@some_context()
def some_function():
    # we are inside a with some_context() now. 
    ...


```

When I created a version of asynccontextmanager internally before it was available in the  stdLib I copied this behavior and I have people internally to facebook using this behavior,  Was there a reason this behavior was not replicated to asynccontextmanager?  

I have a diff an tests to add
History
Date User Action Args
2019-10-08 20:57:33friedsetkeywords: + patch
stage: patch review
pull_requests: + pull_request16250
2019-10-08 20:45:49friedcreate