This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Yogesh.Chaudhari
Recipients Yogesh.Chaudhari, dilettant, ezio.melotti, kushal.das, nedbat, neologix, pitrou, r.david.murray, serhiy.storchaka, trent, vstinner
Date 2013-05-13.08:15:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>

1. While I agree with your idea of what you have done in test_os, (particularly, for determining if platform is supported or not) there seems to be no reason(AFAIK) to have a shutil for cpu_count. I agree with neologox there.

2. Also I am not comfortable with the idea of having multiple 'implementations' of cpu_count. 
"There should be one-- and preferably only one --obvious way to do it."

3. The idea of returning 1 by default does not seem to serve a useful purpose. It should be left to the end-user to decide what needs to be done based on error/actual_value received from system. (+1 to Antoine and nedbat)
For eg,

a. Let's say someone works on scheduling and power managment modules. It is important to know that the platform does not support providing cpu_count() instead of giving 1. This will ensure that they don't go about erroneously setting wrong options for scheduler and/or overclocking the CPU too much(or too little).

b. On the other hand if another user just wants to use a cpu_count number from a his application to determine the number of threads to spawn he can set 
th = cpu_count() or 1 
(on a side note: *usually* for programs that are non IO intensive and require no/little synchronization it is best to spawn cpu_count() number of threads) 

These are just 2 examples to demonstrate that it must be the end-user who decides what to do with the proper_value or reasonable_error_value given by cpu_count()

4. +1 to Antoine on last comment ;-)
Date User Action Args
2013-05-13 08:15:46Yogesh.Chaudharisetrecipients: + Yogesh.Chaudhari, pitrou, vstinner, nedbat, trent, ezio.melotti, r.david.murray, neologix, serhiy.storchaka, kushal.das, dilettant
2013-05-13 08:15:46Yogesh.Chaudharisetmessageid: <>
2013-05-13 08:15:46Yogesh.Chaudharilinkissue17914 messages
2013-05-13 08:15:46Yogesh.Chaudharicreate