Name

class astroid.nodes.Name(name: str, lineno: int, col_offset: int, parent: NodeNG, *, end_lineno: int | None, end_col_offset: int | None)[source]

Bases: LookupMixIn, NoChildrenNode

Class representing an ast.Name node.

A Name node is something that is named, but not covered by AssignName or DelName.

>>> import astroid
>>> node = astroid.extract_node('range(10)')
>>> node
<Call l.1 at 0x...>
>>> list(node.get_children())
[<Name.range l.1 at 0x...>, <Const.int l.1 at 0x...>]
>>> list(node.get_children())[0].as_string()
'range'
name

The name that this node refers to.