Comparisons and sorting of a numeric class....

Ian Kelly ian.g.kelly at gmail.com
Thu Jan 15 18:05:55 CET 2015


On Thu, Jan 15, 2015 at 12:23 AM, Andrew Robinson
<andrew3 at r3dsolutions.com> wrote:
> Can you name any other language that *does* allow subclassing of
> booleans or creation of new boolean values?
>
> Yes. Several off the top of my head -- and I have mentioned these before.
> They generally come with the extra subclasses pre-created and the user
> doesn't get to create the classes, but only use them; none the less -- they
> have more than two values with which to do logic equations with.
>
> VHDL, Verilog, HDL, Silos III, and there are IEEE variants also.
> C/C++ historically allowed you to do it with instances included, although I
> am not sure it still does.

Sorry, let me rehprase my question. Of course there will be
special-purpose languages that allow you to do interesting things with
the logic values and operators. Can you name any other
*general-purpose* language that allows subclassing of booleans or
creation of new boolean values? If not, it seems rather unfair to
single out Python and marvel that this isn't allowed when it's
actually quite normal to disallow it. Unless you care to provide an
example, I am fairly sure your claim of C/C++ is wrong. The bool type
in C++ is a primitive type, none of which can be inherited from. C
doesn't even have a bool type; at most you have macros for true and
false to 1 and 0, so the "booleans" there are just ordinary integers.



More information about the Python-list mailing list