driscoll at cs.wisc.edu
Sun Jul 1 06:45:25 CEST 2012
On 6/30/2012 19:37, Chris Angelico wrote:
> On Sun, Jul 1, 2012 at 10:08 AM, Ben Finney <ben+python at benfinney.id.au> wrote:
>> I know of no programming language that
>> would give a newcomer to Python that expectation. So where is the norm
>> you're referring to?
> C, SQL, REXX, and many other languages.
In fact, the only language I can find that uses infix notation (i.e. no
Lisp) where it's *not* true that "a < b < c" is equivalent to "(a < b) <
c" is Haskell -- and that's because < is not associative and "a < b < c"
is a syntax error. (FWIW this is my favorite approach.) You may also
want to put Java in there as well, as < is effectively not commutative
in that language. (I didn't try C#.)
I've been programming in Python for a few years and this is the first
time I've seen this. If I had seen that in a program, I'd have assumed
it was a bug.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 552 bytes
Desc: OpenPGP digital signature
More information about the Python-list