On 8 Aug 2009, at 08:02 , Steven D'Aprano wrote:
On Fri, 7 Aug 2009 08:22:14 pm Kristján Valur Jónsson wrote:
Unless I am very much mistaken, this is the approach Ruby takes.
Everything is an expression.  For example, the value of a block is
the value of The last expression in the block.

Copying what other languages do is not necessarily a bad thing, but that
would fail both "explicit is better than implicit" and "in the face of
ambiguity, avoid the temptation to guess".
The first objection one might be able to give, you maybe, but the second one? Where's the ambiguity in "compound statements return the result of the last evaluated expression"?

It's not immediately obvious to me why the last expression should be
given that privileged rule. Why not the first expression?

Because it wouldn't make any sense? When you're computing something, the value you want is the one at the end of the computation (usually called a result), not some random one somewhere else.

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to