3 ms·
It's not a valid production for 'atom' in the grammar[1]. https://docs.python.org/3/reference/grammar.html https://docs.python.org/3/reference/grammar.html
by rwbhn 7y ago
It's not a valid production for 'atom' in the grammar[1].
https://docs.python.org/3/reference/grammar.html https://docs.python.org/3/reference/grammar.html
- deathanatos 7y agoI presume your parent is referring to the double nonlocal/global statements, which are never valid productions for the atom grammar even when they are validly produced. Here, the production is func_body_suite → stmt+ → (stmt, stmt) → (simple_stmt, simple_stmt) → (small_stmt, small_stmt) → (global_stmt, nonlocal_stmt) ; syntactically, I'm inclided to agree that the code sample seems valid. (It is, of course, semantically malformed.) I suspect that there just never was a separate exception type for this sort of thing.