[Python-Dev] Py3k: Except clause syntax

Ron Adam rrr at ronadam.com
Mon Mar 20 19:49:19 CET 2006


skip at pobox.com wrote:
>     Skip> There seem to be other places where Python is beginning to require
>     Skip> parens even though they aren't strictly necessary to resolve
>     Skip> syntactic ambiguity.
> 
>     Guido> In the style guide only, I hope.
> 
>     Alex> Technically, I believe the first place where this did not apply
>     Alex> was list comprehensions, ...
> 
> This was the instance I was thinking of, but it was far enough back that I
> didn't remember if it was for readability or disambiguation.

There is also the cases of types needing parens such as tuple((1,2,3)). 
   The same is true for dict, list, and sets.  They could have been 
written to accept individual items, (not a suggestion as it is slower), 
so requiring tuples, sets, and/or sequences where they are used as such 
isn't unexpected.

But as long as I can do the following I will be happy.

    some_exc_group = (some_except, some_except, some_except)

    try:
       ...
    except excgroup as value:
       ...

Cheers,
    Ron




More information about the Python-Dev mailing list