code review

Evan Driscoll driscoll at cs.wisc.edu
Sun Jul 1 06:57:36 CEST 2012


On 6/30/2012 23:45, Evan Driscoll wrote:
> 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 guess you could actually put Lua and Ruby into the roughly same
category as Java too.

But things get a little nastier in ==, as 'false == false == false'
evaluates as '(false == false) == false' to 'false' in Java and Lua.
(Ruby produces a syntax error for this, roughly the Haskell approach.)

But we have Javascript:
  1 < 1 < 2
  => true
  false == false == false
  => false

O'Caml:
  # false == false == false;;
  - : bool = false
  # 1 < 2 < true;;
  - : bool = false

Java:
  System.out.println(false == false == false);
  (outputs) false

Lua:
  > print(false == false == false)
  false

C and C++:
  std::cout << (1 < 1 < 3) << "\n";
  (outputs) 1
  std::cout << (false == false == false) << "\n";
  (outputs) 0

Evan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 552 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20120630/1ba98b26/attachment.sig>


More information about the Python-list mailing list