[Python-Dev] API and process questions (sparked by Claudiu Popa on 16104

Jim J. Jewett jimjjewett at gmail.com
Mon Apr 28 19:29:05 CEST 2014


On Mon, Apr 28, 2014 at 12:56 PM, Charles-François Natali
<cf.natali at gmail.com> wrote:
> Why would the user care if multiprocessing is used behind the scene?

Err ... that was another set of questions that I forgot to ask.

(A)  Why bother raising an error if multiprocessing is unavailable?
After all, there is a perfectly fine fallback...

On other hand, errors should not pass silently.  If a user has
explicitly asked for multiprocessing, there should be some notice that
it didn't happen.  And builds are presumably something that a
developer will monitor to respond to the Exception.

(A1)  What sort of Error?  I'm inclined to raise the original
ImportError, but the patch prefers a ValueError.

(B)  Assuming the exception, I suppose your question adds a 3rd
special case of "Whatever the system suggests, and I don't care
whether or not it involves multiprocessing."

> It would be strange for processes=1 to fail if multiprocessing is not
> available.

As Claudiu pointed out, processes=1 should really mean 1 worker
process, which is still different from "do everything in the main
process".  I'm not sure that level of control is really worth the
complexity, but I'm not certain it isn't.

> processes <= 0: use os.cpu_count()

I could understand doing that for 0 or -1; what is the purpose of
doing it for both, let alone for -4?

Are we at the point where the parameter should just take positive
integers or one of a set of specified string values?

-jJ


More information about the Python-Dev mailing list