[Python-ideas] Make decorator-based context managers reentrant

2023-03-30 Thread Tobias Bengfort
Hi, I was wondering why decorator-based context managers are not reentrant or even reusable. They could be made reusable by initializing the generator in __enter__() instead of __init__(). They could be made reentrant by storing generatos in a stack. A similar thing has been implemented for

[Python-ideas] Re: Make decorator-based context managers reentrant

2023-03-30 Thread Tobias Bengfort
On 30/03/2023 09.21, Barry wrote: On 30 Mar 2023, at 08:10, Tobias Bengfort wrote: I was wondering why decorator-based context managers are not reentrant or even reusable. Do you mean this use of reentrant? https://en.wikipedia.org/wiki/Reentrancy_(computing) I mean mean it as used in