New submission from sblondon <[email protected]>:
mailbox.Mailbox has a .close() method that should be called at the end of
Mailbox use.
I think it would be nice to use Mailbox instances with a 'with' statement so
.close() will be called it automatically. So there is no need to check for
which format it's required (yes for mbox, no for Maildir, etc.)
So the source code:
mbox = mailbox.mbox("/path/to/mbox")
...
mbox.close()
could become:
with mailbox.mbox("/path/to/mbox") as mbox:
...
----------
components: Library (Lib)
messages: 307744
nosy: sblondon
priority: normal
severity: normal
status: open
title: Add context management to mailbox.Mailbox
type: enhancement
_______________________________________
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