Russell E. Owen wrote:
In article <d28975e8-6706-4515-9c9e-fb7f90775...@masklinn.net>,
 Xavier Morel <catch-...@masklinn.net> wrote:

On 6 Aug 2009, at 00:22 , Jeff McAninch wrote:
I'm new to this list, so please excuse me if this topic has been discussed, but I didn't
see anything similar in the archives.

I very often want something like a try-except conditional expression similar
to the if-else conditional.
I fear this idea is soon going to extend to all compound statements one by one.

Wouldn't it be smarter to fix the issue once and for all by looking into making Python's compound statements (or even all statements without restrictions) expressions that can return values in the first place? Now I don't know if it's actually possible, but if it is the problem becomes solved not just for try:except: (and twice so for if:else:) but also for while:, for: (though that one's already served pretty well by comprehensions) and with:.

I like this idea a lot.

For some reason this kind of reminds me of BCPL.

A function definition looked like:

    LET func_name(arg1, arg2) = expression

so, strictly speaking, no multiline functions.

However, there was also the VALOF ... RESULTIS ... block.

In Python, the 'return' statement provides the result of a function; in
BCPL, the 'RESULTIS' statement provided the result of the VALOF block,
which was call from within an expression, like:

    LET foo(...) = VALOF
    $(
        ...
        RESULTIS expression
    $)
_______________________________________________
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