This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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 <>
> 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>
except ... as <identifier>:

global <identifier>
nonlocal <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.
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: <>
2021-03-12 21:30:32BTaskayalinkissue42128 messages
2021-03-12 21:30:32BTaskayacreate