Michael Williamson added the comment:

> Using 'expression' (or 'expr' in the ast doc) for what should be 'exceptions: 
> identifier' or paranthesized tuple of identifiers;, is also too broad. 
> However, that must be enforced in the compiler rather than the parser, and 
> compiler restrictions are in the text, not the grammar.

I would expect any expression to be valid so long as it evaluates at runtime to 
an exception type (or tuple of exception types), so the use of expression seems 
correct to me. In other words, the following is valid Python (but would not be 
allowed if I've understood your statement correctly):

    def f():
        try:
            "".blah
        except some_error():
            print("caught")
            
    def some_error():
        return AttributeError

    f()

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22243>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to