|
|
|
|
|
by baq
595 days ago
|
|
it's using context managers to manage context i.e. state that is there but isn't needed to be referenced by code directly. it's the whole point. you can do it all with just functions or objects (doesn't matter, functions are objects in Python anyway) by design, context managers are there for DRY purposes. |
|
It would feel a lot better if it was this, for example, where you use each context explicitly:
As as the parent also suggests, this then doesn't really need the context management at all