Hi all,
few days ago I thought about a way to rapresent sets and
ordered dicts using a json compatible syntax, these are my conclusions:
A set could be defined as { item1, item2, item3[...] }
with {,} as an empty set
An ordered dict could be defined as [ item1: value1, item2: value2 ... ]
with [:] ase an empty odered dict
It could be used inside python code or to serialize python structures in
a json-like format (pyson maybe ?).
What do you think about ?
Kind regards, Matteo.
--
email: nastasi(a)alternativeoutput.it, matteo.nastasi(a)gmail.com
web: www.alternativeoutput.it irc: #linux-mi(a)irc.freenode.net
linkedin: http://lnkd.in/SPQG87
Recently os.cpu_count() on Windows has been fixed in order to take process
groups into account and return the number of all available CPUs:
http://bugs.python.org/issue30581
This made me realize that os.cpu_count() does not return the number of
*usable* CPUs, which could possibly represent a better default value for
things like multiprocessing and process pools.
It is currently possible to retrieve this info on UNIX with
len(os.sched_getaffinity(0)) which takes CPU affinity and (I think) Linux
cgroups into account, but it's not possible to do the same on Windows which
provides this value via GetActiveProcessorCount() API.
As such I am planning to implement this in psutil but would like to know
how python-ideas feels about adding a new os.usable_cpu_count() function
(or having os.cpu_count(usable=True)).
Thoughts?
--
Giampaolo - http://grodola.blogspot.com