Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

Is closing a mailbox in __exit__ the most desirable operation?

In the last example on https://docs.python.org/3/library/mailbox.html#examples 
inbox is locked and unlocked multiple times. The with statement couldn't be 
used here.

On https://pymotw.com/3/mailbox/ some examples use the idiom

    mbox = ...
    mbox.lock()
    try:
        ...
    finally:
        mbox.unlock()

and others use the idiom

    mbox = ...
    mbox.lock()
    try:
        ...
    finally:
        mbox.flush()
        mbox.close()

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32234>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to