astroid
astroid copied to clipboard
Turn `ImportFrom.names` into a list of `NamedTuple`
Current behavior
Each entry is a tuple of the name being imported, and the alias that the name is assigned to (if any).
Expected behavior
Have something that acts like an ast.alias object.
So that could be acheived by using NamedTuple, this would keep the compatibility with the normal tuple usage and would allow to be used like it was an ast.alias object, such that less effort is needed to adopt astroid.
alias = namedtuple('alias', ('name', 'asname'))
Astroid version: 2.9.3
In theory it's a good idea. However I would prefer not to change it before the Import nodes are re-done at some point. We may want to add a dedicated node class for Alias, having a NamedTuple with the same name could be confusing.