Message189199
> Well, they can be wrong sometimes, too :-)
Indeed, as can I ;-)
> The patch doesn't seem to rely on the glibc, so we are fine here.
> Or do the other libs work likewise?
sysconf(_SC_NPROCESSORS_CONF) is implemented with the above function
in the glibc.
For other Unix systems apparently they use the sysctl() syscall, and I
don't *think* it can fail to return the number of CPUs. So the only
platforms where it could in theory fail are things like Cygwin, etc.
>
>> And the DSL processor takes care of the rest.
>>
>> What does this become if your return object isn't typed?
>
> It's typed, just the type is "int or None". I'm sure some
> statically-typed languages are able to express this (OCaml? Haskell?).
I recently started learning Haskell. You have Either and Maybe that
could fall into that category.
> Anyway, I don't mind whether it's None or 0 or -42. But let's not hide
> the information.
I liked your suggestion of making it an enum:
>>> os.cpu_count()
<CPUCount.UnknownCount: 42>
Nah, None is fine to me! |
|
Date |
User |
Action |
Args |
2013-05-14 05:36:54 | neologix | set | recipients:
+ neologix, pitrou, vstinner, nedbat, trent, ezio.melotti, r.david.murray, serhiy.storchaka, kushal.das, dilettant, Yogesh.Chaudhari |
2013-05-14 05:36:54 | neologix | link | issue17914 messages |
2013-05-14 05:36:54 | neologix | create | |
|