Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #69030

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

References <CA+7ESbr9i6VEO709jPF8ghoPRsUggqBrCEJhoXBn7LK6wYSA+w@mail.gmail.com> <mailman.8474.1395707125.18130.python-list@python.org> <80cf8fb7-d0c5-43a9-bc6f-c61ce6214f98@googlegroups.com> <mailman.8484.1395719089.18130.python-list@python.org> <8d59e3a4-e6af-4633-869b-53568f6091cd@googlegroups.com>
Date 2014-03-26 01:00 +1100
Subject Re: advice on sub-classing multiprocessing.Process and multiprocessing.BaseManager
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.8522.1395756056.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Mar 26, 2014 at 12:34 AM,  <matt.newville@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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: advice on sub-classing multiprocessing.Process and multiprocessing.BaseManager Chris Angelico <rosuav@gmail.com> - 2014-03-25 11:19 +1100
  Re: advice on sub-classing multiprocessing.Process and multiprocessing.BaseManager matt.newville@gmail.com - 2014-03-24 20:27 -0700
    Re: advice on sub-classing multiprocessing.Process and multiprocessing.BaseManager Chris Angelico <rosuav@gmail.com> - 2014-03-25 14:44 +1100
      Re: advice on sub-classing multiprocessing.Process and multiprocessing.BaseManager matt.newville@gmail.com - 2014-03-25 06:34 -0700
        Re: advice on sub-classing multiprocessing.Process and multiprocessing.BaseManager Chris Angelico <rosuav@gmail.com> - 2014-03-26 01:00 +1100

csiph-web