Batuhan Taskaya <isidenti...@gmail.com> added the comment:

> This seams really inconsistent with the rest of the ast, where identifiers 
> are always wrapped in a ast.Name object. The only other exception to this is 
> ast.Attribute.

import ... as <identifier>
from ... import ... as <identifier>
try:
   ...
except ... as <identifier>:
   ...

global <identifier>
nonlocal <identifier>
x(<identifier>=...)

All <identifier>s above are represented as strings. If <identifier> is 
guaranteed to be a single name, then it makes sense to just use an identifier 
instead of wrapping it with Name(). The reason that other stuff like "with ... 
as <expr>" uses <expr> instead of <identifier> is that you can use extended 
assignment targets (such as unpacking a tuple) over there. 

This rule applies to all other stuff, except for NamedExprs. Which I believe it 
is because the restriction might lift in the future, but now they are limited 
to only keep Name()s. 

I don't personally know why Brandt choosed to use identifier, though I'm a +1 
on the current approach.

----------

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

Reply via email to