Author BTaskaya
Recipients BTaskaya, Daniel Moisset, brandtbucher, freundTech, gvanrossum, kj, laurenjl, lys.nikolaou, pablogsal, rhettinger, willingc, xtreak
Date 2021-03-12.21:30:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1615584632.85.0.852512197446.issue42128@roundup.psfhosted.org>
In-reply-to
Content
> 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.
History
Date User Action Args
2021-03-12 21:30:32BTaskayasetrecipients: + BTaskaya, gvanrossum, rhettinger, willingc, Daniel Moisset, lys.nikolaou, pablogsal, xtreak, brandtbucher, kj, laurenjl, freundTech
2021-03-12 21:30:32BTaskayasetmessageid: <1615584632.85.0.852512197446.issue42128@roundup.psfhosted.org>
2021-03-12 21:30:32BTaskayalinkissue42128 messages
2021-03-12 21:30:32BTaskayacreate