Barry A. Warsaw <[email protected]> added the comment:
Yes, I think this is a good idea. Would you like to submit a PR for it?
FWIW, we have this code in Mailman 3:
class Mailbox(MMDF):
"""A mailbox that interoperates with the 'with' statement."""
def __enter__(self):
self.lock()
return self
def __exit__(self, *exc):
self.flush()
self.unlock()
# Don't suppress the exception.
return False
----------
nosy: +barry
versions: +Python 3.7
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue32234>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com