You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reasons to deprecate it
=======================
- it's calculated at import time, also unnecessarily if the user does not use it later
- import time is risky: if the retrieval fails for some reason the whole
program will explode (see for example issue 188 ). Right now we alleviate the
problem by catching the exception and produce a warning but it's sub optimal.
Replacement
===========
- a new psutil.cpu_count() can be introduced
- that will also be consistent with os.cpu_count() introduced in python 3.4
http://docs.python.org/3.4/library/os.html#os.cpu_count - it paves the way for
upcoming psutil.phys_cpu_count() (see issue 427 )
Deprecation process
===================
Deprecation of a module level constant is harder than deprecating a function
because it's more tricky:
http://stackoverflow.com/questions/9937279/can-modules-have-properties
http://stackoverflow.com/questions/880530/can-python-modules-have-properties-the-same-way-that-objects-can
I expect to introduce the "module property" hack in some next version (say
1.3.0) which will produce a DeprecationWarning and remove it completely in a
major one (say 2.0.0) along with others already deprecated APIs such as
psutil.BOOT_TIME.
From g.rodola on December 03, 2013 19:08:28
Original issue: http://code.google.com/p/psutil/issues/detail?id=450
The text was updated successfully, but these errors were encountered: