code review

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Jul 1 20:41:32 EDT 2012


On Sun, 01 Jul 2012 05:18:09 -0400, Devin Jeanpierre wrote:

> Also, you claimed earlier that the notion of associative "<" is not
> founded in mathematical notation. It really depends on whose
> mathematical notation you use -- there's more than one, you know. For
> example, it's reasonable to expect < to be left- or right-associative in
> a system like Rick Hehner's Unified Algebra:
> http://www.cs.toronto.edu/~hehner/UA.pdf (although, he himself doesn't
> specify it as being one or the other, so by default one would assume 'a
> < b < c' to be nonsensical.)

Sheesh guys. Don't go hunting through the most obscure corners of 
mathematics for examples of computer scientists who have invented their 
own maths notation. (Which, by your own admission, is under-specified and 
therefore incomplete.) Who uses Hehner's "Unified Algebra" notation? 
Apart from Hehner, if he even uses it himself.

Pick up any standard maths book and you will see chained comparisons used 
with exactly the meaning that Python gives them.

For example, Wolfram MathWorld uses it:

http://mathworld.wolfram.com/Inequality.html


Chained comparisons in the Python sense may be rare in computer 
languages, but it is the standard in mathematics and hardly needs to be 
explained to anyone over the age of twelve. That is a terrible indictment 
on the state of programming language design.



-- 
Steven



More information about the Python-list mailing list