[issue23400] Inconsistent behaviour of multiprocessing.Queue() if sem_open is not implemented

Davin Potts report at bugs.python.org
Sat Mar 7 00:36:53 CET 2015


Davin Potts added the comment:

> No, I suggested to replace only the line that produces AttributeError now.

Ah!  Sorry, I misunderstood and incorrectly assumed you were imagining the import to happen at the top of the module.

I must confess I am hesitant about the idea of putting an import inside the Queue.__init__ (or any method) because I generally don't consider it a best practice -- that said, there are a number of places within (not only) the multiprocessing module where imports are performed dynamically as part of implementations for various methods, but it bothers me when I see those as well.  Yet your solution is simple and offers the benefit of not having the same (or nearly the same) text appear twice in the code.

Berker: Do you have any strong feeling on this idea?  If not, I am tempted to bend on my instinctive reaction here and go with Serhiy's style.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23400>
_______________________________________


More information about the Python-bugs-list mailing list