[Python-Dev] bool does not want to be subclassed? (original) (raw)

François Pinard pinard at iro.umontreal.ca
Fri Feb 13 12:01:39 EST 2004


[Joshua Marshall]

[...] if it doesn't make sense to create a sort of boolean which isn't in the set { true, false }, then it doesn't make sense to create a sort of integer which isn't in the set { ..., -2, -1, 0, 1, 2, ... }.

Merely chatting, here.

In that same big application for which I considered (for a short moment) sub-classing bool' to "mark" booleans with their computation origin, we have a particular other kind-of-boolean type, heavily used in the application, which runs six values from full falsity to full truth. Python surely made it very elegant. This one, I would have never ever considered sub-typing from bool' :-). For fun, we named the constructor `poul' and we speak of pouleans, as a friendly tease to the mathematician in the team who decided the details of this particular logic (Jacques Poulin).

About interesting extensions to integers, and to all kind of numbers in fact, including wet ones :-), a good read is the John Conway book: "On games and numbers". However, it is not worth a Python module yet! :-)

-- François Pinard http://www.iro.umontreal.ca/~pinard



More information about the Python-Dev mailing list