On 2021-05-09 21:11, Bruce Leban wrote:
On Sun, May 9, 2021 at 9:48 AM Thomas Grainger <tagrain@gmail.com <mailto:tagrain@gmail.com>> wrote:
now that python2.7 is EOL, it might be worth resurrecting this syntax as discussed in https://www.python.org/dev/peps/pep-3100/#id13 <https://www.python.org/dev/peps/pep-3100/#id13>
eg, python 3.11 could support ``` try: ... except (E1, E2, E3) as e: ... ```
as equivalent to
``` try: ... except E1, E2, E3 as e: ... ```
-1
I think you really mean you want Python to accept the form without the parenthesis. I don't like it because it's easy to read that as
except E1, E2, (E3 as e):
and I don't think saving two characters is worth the disruption caused by people being able to write Python 3.11 code that won't work in Python 3.10. Many people would not adopt the new syntax for that reason.
I'm not keen on it either. On the other hand, binding to e for E3 but not for E1 or E2 would be kind of weird, and "e = E1, E2, E3" is valid. On the third hand(!), 'as' is used in the 'import' and 'with' statements, where it binds to only one preceding item.