On Thu, May 12, 2011 at 11:46 PM, rusi <rustompm...@gmail.com> wrote: <snip> > The boolean domain is only a 100 years old. > Unsurprisingly it is not quite 'first-class' yet: See
It is nowadays. Every halfway-mainstream language I can think of has an explicit boolean datatype. Heck, as of C99, even C has one now. I conjecture the only languages still lacking one are exotic niche/fringe languages. I would be interested to see a counterexample. > http://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EWD1070.html > [Lifted from http://c2.com/cgi/wiki?EqualVsTrueFalse ] > > ---------------------------- > "In retrospect, one might be tempted to regard the introduction of > something as simple as the boolean domain as a minor invention, but I > think that that would be a grave mistake: it is a great invention > because, being so simple, it is such a powerful simplifier. It is of > the same level as the introduction of natural numbers, which enabled > us to add 3 to 5, regardless of whether we are adding apples or > pears." > > "George Boole made a radical invention, so radical, in fact, that now, > more than a century later, the scientific community has not absorbed > it yet. (To stay with the metaphor: officially, boolean expressions > may have reached the status of first-class citizens, in practice — > because old habits and prejudices die hard— they are still the victims > of discrimination.) Let me give you a few examples." > > "In the programming language FORTRAN, as conceived a century after > Boole published his invention, boolean expressions are allowed, but > there are no boolean variables! Their introduction into programming > had to wait until the design of ALGOL 60." > > ------------------------ > So, M Harris problem is that python could almost be a language for the > 'masses' (whatever that might mean) were it not for warts like "l not > is empty" is shorten-able to just "l" One language's wart is another language's idiom. And I think the irrational hate towards syntactically-significant indentation is by far a much larger barrier to "mass" adoption of Python; C++ has some features that are at least (if not more) subtle/unobvious than Python's __bool__(), yet it still enjoys "mass" use. > Dijkstra's problem (paraphrased) is that python, by choosing the > FORTRAN alternative of having a non-first-class boolean type, hinders > scientific/mathematical thinking/progress. Python has *not* chosen the Fortran alternative; *it has a first-class Boolean type*, namely bool. This line of argument thus fails. The fact that other types are implicitly coercible to bools doesn't make `bool` itself any less first-class. It is also ironic that one of the projects that exploits Python's flexible typing regarding normally-Boolean operators is a scientific one (NumPy). Cheers, Chris -- http://rebertia.com -- http://mail.python.org/mailman/listinfo/python-list