[Python-ideas] except expression
Chris Angelico
rosuav at gmail.com
Tue Feb 18 14:37:04 CET 2014
More information about the Python-ideas mailing list
Tue Feb 18 14:37:04 CET 2014
- Previous message: [Python-ideas] except expression
- Next message: [Python-ideas] except expression
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Feb 19, 2014 at 12:00 AM, Paul Moore <p.f.moore at gmail.com> wrote: > On 18 February 2014 12:49, MRAB <python at mrabarnett.plus.com> wrote: >>> I really think that this proposal needs to focus on the short, simple >>> use cases and *not* worry about too much generality. For example: >>> >>> sum(x[3] except 0 for x in list_of_tuples) >>> >> Shouldn't that be: >> >> >> sum(x[3] except: 0 for x in list_of_tuples) >> >> (colon added)? > > Only if you feel that a colon is necessary for the syntax. I don't :-) The colon is necessary if the new syntax should allow the specification of the exception. If it's always equivalent to a bare except that doesn't capture the exception object, then it'd be unnecessary. Personally, I don't want to create a special syntax that does something that's strongly discouraged. I'm open to argument that the expression-except should accept just a single except clause; I'm open to argument that it shouldn't be able to capture (due to complications of creating sub-scopes), though that's more a nod to implementation/specification difficulty than any conceptual dislike of the syntax (it's clean, it's consistent, it's sometimes useful); but I don't want to narrow this down to always having to catch everything. ChrisA
- Previous message: [Python-ideas] except expression
- Next message: [Python-ideas] except expression
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list