advice on sub-classing multiprocessing.Process and multiprocessing.BaseManager

Chris Angelico rosuav at gmail.com
Tue Mar 25 15:00:52 CET 2014


On Wed, Mar 26, 2014 at 12:34 AM,  <matt.newville at gmail.com> wrote:
> Monkey-patching multiprocessing.Process seems more fragile than subclassing it.  It turned out that multiprocessing.pool.Pool was also very easy to subclass.  But cleanly subclassing the Managers in multiprocessing.managers look much harder.  I'm not sure if this is intentional or not, or if it should be filed as an issue for multiprocessing.   For now, I'm willing to say that the multiprocessing managers are not yet available with the pyepics library.
>

Subclassing is actually more fragile than you might think. As you've
found, you need to fidget with more and more classes to make your
change "stick", and also, any small change to implementation details
in the superclass could suddenly break things. It's not really any
safer than monkeypatching, despite all the OO fanatics saying how easy
it is to rework by subclassing. At least when you monkeypatch, you
*know* you're fiddling with internals.

ChrisA



More information about the Python-list mailing list