Nick Coghlan <ncogh...@gmail.com> added the comment:

I don't know the mailbox API particularly well, but the fact the object offers 
all three of lock(), unlock() and close() as methods does imply a fair bit of 
inherent ambiguity.

One option would be to offer a module level "mailbox.locked()" API to handle 
the lock/unlock case, and then have native context management on the mailbox 
itself that was akin to "contextlib.closing".


(Note regarding contextlib.locked(): the reason we don't currently have that is 
because there's no consistent protocol for locking method names. 
acquire()/release() and lock()/unlock() would be the most popular pairings, so 
we could technically offer both "contextlib.acquired()" and 
"contextlib.locked()", but the duplication still seems a bit dubious to me)

----------

_______________________________________
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