[Python-Dev] PEP 463: Exception-catching expressions
Ronald Oussoren
ronaldoussoren at mac.com
Thu Feb 27 09:44:45 CET 2014
On 21 Feb 2014, at 16:52, Chris Angelico <rosuav at gmail.com> wrote:
> On Sat, Feb 22, 2014 at 1:34 AM, Brett Cannon <brett at python.org> wrote:
>> While I like the general concept, I agree that it looks too much like a
>> crunched statement; the use of the colon is a non-starter for me. I'm sure
>> I'm not the only one whose brain has been trained to view a colon in Python
>> to mean "statement", period. This goes against that syntactic practice and
>> just doesn't work for me.
>>
>> I'm -1 with the current syntax, but it can go into the + range if a better
>> syntax can be chosen.
>
> We bikeshedded that extensively on -ideas. The four best options are:
>
> value = (expr except Exception: default)
> value = (expr except Exception -> default)
> value = (expr except Exception pass default)
> value = (expr except Exception then default)
>
> Note that the last option involves the creation of a new keyword.
>
> Would any of the others feel better to you?
What about (also mentioned in the PEP)?
value = (expr except Exception try default)
This seems to read nicely, although “try” is at a completely different position than it is in the equivalent try statement.
I like the general idea, but like Brett I don’t like using a colon here at all.
Ronald
P.S. Sorry if this way already brought up, I’ve browsed through most of the threads on this on -ideas and -dev, but haven’t read all messages.
>
> ChrisA
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/ronaldoussoren%40mac.com
More information about the Python-Dev
mailing list