Charles-François Natali added the comment: > 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! ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17914> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com