Michel Pelletier wrote:
"M.-A. Lemburg" wrote:
Also, why should we hide something useful from the Python programmer if it's there anyway ? (One thing I've always wondered about is why Python doesn't expose Py_True and Py_False through the builtin module...)
I have no idea why they are not exposed, of course. but my guess would be because there is no boolean type, there is no need for them. I myself have never needed a boolean type, "zero" or "empty" have always worked for me as a boolean false.
What are they used at the C level for?
All simple compares return either Py_True or Py_False (e.g. 1==1 returns a reference to Py_True).
I guess, I'll add a constructor to mx.Tools, my repository for missing builtins ;-)
Does mx.Tools offer a boolean type?
No, but I'm thinking about adding a Boolean number type to mxNumber. I'll also need some form of a binary type to make the set complete for XML-RPC.
Currently, I can work around this by using True and False (which mx.Tools adds) and using buffer objects as wrappers to mean "this is a binary type".