[issue45184] Add `pop` function to remove context manager from (Async)ExitStack

Václav Brožík report at bugs.python.org
Fri Feb 18 06:08:40 EST 2022


Václav Brožík <vbrozik at gmail.com> added the comment:

There was an interesting discussion about this problem in 2015-12:
https://mail.python.org/archives/list/python-ideas@python.org/thread/Y3SLBJHJHAMBEZJWRXEJ5LE5JBVNE7XS/
(https://groups.google.com/g/python-ideas/c/l2FcErYbjfo - for the case the link above rots)

Certainly there are use cases for this functionality when you need to dynamically open multiple resources and close them when they are not needed any more. Keeping resources open till the very end of ExitStack is a bad practice which can lead to locking problems or overuse of resources.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45184>
_______________________________________


More information about the Python-bugs-list mailing list