doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
array.fromlist(list) Append items from the list. This is equivalent to for x in list: a.append(x) except that if there is a type error, the array is unchanged.
python.library.array#array.array.fromlist
array.fromunicode(s) Extends this array with data from the given unicode string. The array must be a type 'u' array; otherwise a ValueError is raised. Use array.frombytes(unicodestring.encode(enc)) to append Unicode data to an array of some other type.
python.library.array#array.array.fromunicode
array.index(x) Return the smallest i such that i is the index of the first occurrence of x in the array.
python.library.array#array.array.index
array.insert(i, x) Insert a new item with value x in the array before position i. Negative values are treated as being relative to the end of the array.
python.library.array#array.array.insert
array.itemsize The length in bytes of one array item in the internal representation.
python.library.array#array.array.itemsize
array.pop([i]) Removes the item with the index i from the array and returns it. The optional argument defaults to -1, so that by default the last item is removed and returned.
python.library.array#array.array.pop
array.remove(x) Remove the first occurrence of x from the array.
python.library.array#array.array.remove
array.reverse() Reverse the order of the items in the array.
python.library.array#array.array.reverse
array.tobytes() Convert the array to an array of machine values and return the bytes representation (the same sequence of bytes that would be written to a file by the tofile() method.) New in version 3.2: tostring() is renamed to tobytes() for clarity.
python.library.array#array.array.tobytes
array.tofile(f) Write all items (as machine values) to the file object f.
python.library.array#array.array.tofile
array.tolist() Convert the array to an ordinary list with the same items.
python.library.array#array.array.tolist
array.tounicode() Convert the array to a unicode string. The array must be a type 'u' array; otherwise a ValueError is raised. Use array.tobytes().decode(enc) to obtain a unicode string from an array of some other type.
python.library.array#array.array.tounicode
array.typecode The typecode character used to create the array.
python.library.array#array.array.typecode
array.typecodes A string with all available type codes.
python.library.array#array.typecodes
ascii(object) As repr(), return a string containing a printable representation of an object, but escape the non-ASCII characters in the string returned by repr() using \x, \u or \U escapes. This generates a string similar to that returned by repr() in Python 2.
python.library.functions#ascii
exception AssertionError Raised when an assert statement fails.
python.library.exceptions#AssertionError
ast — Abstract Syntax Trees Source code: Lib/ast.py The ast module helps Python applications to process trees of the Python abstract syntax grammar. The abstract syntax itself might change with each Python release; this module helps to find out programmatically what the current grammar looks like. An abstract syntax tr...
python.library.ast
class ast.Add class ast.Sub class ast.Mult class ast.Div class ast.FloorDiv class ast.Mod class ast.Pow class ast.LShift class ast.RShift class ast.BitOr class ast.BitXor class ast.BitAnd class ast.MatMult Binary operator tokens.
python.library.ast#ast.Add
class ast.alias(name, asname) Both parameters are raw strings of the names. asname can be None if the regular name is to be used. >>> print(ast.dump(ast.parse('from ..foo.bar import a as b, c'), indent=4)) Module( body=[ ImportFrom( module='foo.bar', names=[ alias(n...
python.library.ast#ast.alias
class ast.And class ast.Or Boolean operator tokens.
python.library.ast#ast.And
class ast.AnnAssign(target, annotation, value, simple) An assignment with a type annotation. target is a single node and can be a Name, a Attribute or a Subscript. annotation is the annotation, such as a Constant or Name node. value is a single optional node. simple is a boolean integer set to True for a Name node in...
python.library.ast#ast.AnnAssign
class ast.arg(arg, annotation, type_comment) A single argument in a list. arg is a raw string of the argument name, annotation is its annotation, such as a Str or Name node. type_comment type_comment is an optional string with the type annotation as a comment >>> print(ast.dump(ast.parse("""\ ... @decorator1 .....
python.library.ast#ast.arg
type_comment type_comment is an optional string with the type annotation as a comment
python.library.ast#ast.arg.type_comment
class ast.arguments(posonlyargs, args, vararg, kwonlyargs, kw_defaults, kwarg, defaults) The arguments for a function. posonlyargs, args and kwonlyargs are lists of arg nodes. vararg and kwarg are single arg nodes, referring to the *args, **kwargs parameters. kw_defaults is a list of default values for keyword-on...
python.library.ast#ast.arguments
class ast.Assert(test, msg) An assertion. test holds the condition, such as a Compare node. msg holds the failure message. >>> print(ast.dump(ast.parse('assert x,y'), indent=4)) Module( body=[ Assert( test=Name(id='x', ctx=Load()), msg=Name(id='y', ctx=Load()))], type_ignores=[...
python.library.ast#ast.Assert
class ast.Assign(targets, value, type_comment) An assignment. targets is a list of nodes, and value is a single node. Multiple nodes in targets represents assigning the same value to each. Unpacking is represented by putting a Tuple or List within targets. type_comment type_comment is an optional string with the ...
python.library.ast#ast.Assign
type_comment type_comment is an optional string with the type annotation as a comment.
python.library.ast#ast.Assign.type_comment
class ast.AST This is the base of all AST node classes. The actual node classes are derived from the Parser/Python.asdl file, which is reproduced below. They are defined in the _ast C module and re-exported in ast. There is one class defined for each left-hand side symbol in the abstract grammar (for example, ast.stm...
python.library.ast#ast.AST
lineno col_offset end_lineno end_col_offset Instances of ast.expr and ast.stmt subclasses have lineno, col_offset, lineno, and col_offset attributes. The lineno and end_lineno are the first and last line numbers of source text span (1-indexed so the first line is line 1) and the col_offset and end_col_offset ar...
python.library.ast#ast.AST.col_offset
lineno col_offset end_lineno end_col_offset Instances of ast.expr and ast.stmt subclasses have lineno, col_offset, lineno, and col_offset attributes. The lineno and end_lineno are the first and last line numbers of source text span (1-indexed so the first line is line 1) and the col_offset and end_col_offset ar...
python.library.ast#ast.AST.end_col_offset
lineno col_offset end_lineno end_col_offset Instances of ast.expr and ast.stmt subclasses have lineno, col_offset, lineno, and col_offset attributes. The lineno and end_lineno are the first and last line numbers of source text span (1-indexed so the first line is line 1) and the col_offset and end_col_offset ar...
python.library.ast#ast.AST.end_lineno
lineno col_offset end_lineno end_col_offset Instances of ast.expr and ast.stmt subclasses have lineno, col_offset, lineno, and col_offset attributes. The lineno and end_lineno are the first and last line numbers of source text span (1-indexed so the first line is line 1) and the col_offset and end_col_offset ar...
python.library.ast#ast.AST.lineno
_fields Each concrete class has an attribute _fields which gives the names of all child nodes. Each instance of a concrete class has one attribute for each child node, of the type as defined in the grammar. For example, ast.BinOp instances have an attribute left of type ast.expr. If these attributes are marked as opt...
python.library.ast#ast.AST._fields
class ast.AsyncFor(target, iter, body, orelse, type_comment) class ast.AsyncWith(items, body, type_comment) async for loops and async with context managers. They have the same fields as For and With, respectively. Only valid in the body of an AsyncFunctionDef.
python.library.ast#ast.AsyncFor
class ast.AsyncFunctionDef(name, args, body, decorator_list, returns, type_comment) An async def function definition. Has the same fields as FunctionDef.
python.library.ast#ast.AsyncFunctionDef
class ast.AsyncFor(target, iter, body, orelse, type_comment) class ast.AsyncWith(items, body, type_comment) async for loops and async with context managers. They have the same fields as For and With, respectively. Only valid in the body of an AsyncFunctionDef.
python.library.ast#ast.AsyncWith
class ast.Attribute(value, attr, ctx) Attribute access, e.g. d.keys. value is a node, typically a Name. attr is a bare string giving the name of the attribute, and ctx is Load, Store or Del according to how the attribute is acted on. >>> print(ast.dump(ast.parse('snake.colour', mode='eval'), indent=4)) Expression( ...
python.library.ast#ast.Attribute
class ast.AugAssign(target, op, value) Augmented assignment, such as a += 1. In the following example, target is a Name node for x (with the Store context), op is Add, and value is a Constant with value for 1. The target attribute connot be of class Tuple or List, unlike the targets of Assign. >>> print(ast.dump(ast....
python.library.ast#ast.AugAssign
class ast.Await(value) An await expression. value is what it waits for. Only valid in the body of an AsyncFunctionDef.
python.library.ast#ast.Await
class ast.BinOp(left, op, right) A binary operation (like addition or division). op is the operator, and left and right are any expression nodes. >>> print(ast.dump(ast.parse('x + y', mode='eval'), indent=4)) Expression( body=BinOp( left=Name(id='x', ctx=Load()), op=Add(), right=Name(id='y...
python.library.ast#ast.BinOp
class ast.Add class ast.Sub class ast.Mult class ast.Div class ast.FloorDiv class ast.Mod class ast.Pow class ast.LShift class ast.RShift class ast.BitOr class ast.BitXor class ast.BitAnd class ast.MatMult Binary operator tokens.
python.library.ast#ast.BitAnd
class ast.Add class ast.Sub class ast.Mult class ast.Div class ast.FloorDiv class ast.Mod class ast.Pow class ast.LShift class ast.RShift class ast.BitOr class ast.BitXor class ast.BitAnd class ast.MatMult Binary operator tokens.
python.library.ast#ast.BitOr
class ast.Add class ast.Sub class ast.Mult class ast.Div class ast.FloorDiv class ast.Mod class ast.Pow class ast.LShift class ast.RShift class ast.BitOr class ast.BitXor class ast.BitAnd class ast.MatMult Binary operator tokens.
python.library.ast#ast.BitXor
class ast.BoolOp(op, values) A boolean operation, ‘or’ or ‘and’. op is Or or And. values are the values involved. Consecutive operations with the same operator, such as a or b or c, are collapsed into one node with several values. This doesn’t include not, which is a UnaryOp. >>> print(ast.dump(ast.parse('x or y', mo...
python.library.ast#ast.BoolOp
class ast.Break class ast.Continue The break and continue statements. >>> print(ast.dump(ast.parse("""\ ... for a in b: ... if a > 5: ... break ... else: ... continue ... ... """), indent=4)) Module( body=[ For( target=Name(id='a', ctx=Store()), iter=Name(...
python.library.ast#ast.Break
class ast.Call(func, args, keywords, starargs, kwargs) A function call. func is the function, which will often be a Name or Attribute object. Of the arguments: args holds a list of the arguments passed by position. keywords holds a list of keyword objects representing arguments passed by keyword. When creating a ...
python.library.ast#ast.Call
class ast.ClassDef(name, bases, keywords, starargs, kwargs, body, decorator_list) A class definition. name is a raw string for the class name bases is a list of nodes for explicitly specified base classes. keywords is a list of keyword nodes, principally for ‘metaclass’. Other keywords will be passed to the metac...
python.library.ast#ast.ClassDef
class ast.Compare(left, ops, comparators) A comparison of two or more values. left is the first value in the comparison, ops the list of operators, and comparators the list of values after the first element in the comparison. >>> print(ast.dump(ast.parse('1 <= a < 10', mode='eval'), indent=4)) Expression( body=Co...
python.library.ast#ast.Compare
class ast.comprehension(target, iter, ifs, is_async) One for clause in a comprehension. target is the reference to use for each element - typically a Name or Tuple node. iter is the object to iterate over. ifs is a list of test expressions: each for clause can have multiple ifs. is_async indicates a comprehension is ...
python.library.ast#ast.comprehension
class ast.Constant(value) A constant value. The value attribute of the Constant literal contains the Python object it represents. The values represented can be simple types such as a number, string or None, but also immutable container types (tuples and frozensets) if all of their elements are constant. >>> print(ast...
python.library.ast#ast.Constant
class ast.Break class ast.Continue The break and continue statements. >>> print(ast.dump(ast.parse("""\ ... for a in b: ... if a > 5: ... break ... else: ... continue ... ... """), indent=4)) Module( body=[ For( target=Name(id='a', ctx=Store()), iter=Name(...
python.library.ast#ast.Continue
ast.copy_location(new_node, old_node) Copy source location (lineno, col_offset, end_lineno, and end_col_offset) from old_node to new_node if possible, and return new_node.
python.library.ast#ast.copy_location
class ast.Load class ast.Store class ast.Del Variable references can be used to load the value of a variable, to assign a new value to it, or to delete it. Variable references are given a context to distinguish these cases. >>> print(ast.dump(ast.parse('a'), indent=4)) Module( body=[ Expr( ...
python.library.ast#ast.Del
class ast.Delete(targets) Represents a del statement. targets is a list of nodes, such as Name, Attribute or Subscript nodes. >>> print(ast.dump(ast.parse('del x,y,z'), indent=4)) Module( body=[ Delete( targets=[ Name(id='x', ctx=Del()), Name(id='y', ctx=Del()),...
python.library.ast#ast.Delete
class ast.Dict(keys, values) A dictionary. keys and values hold lists of nodes representing the keys and the values respectively, in matching order (what would be returned when calling dictionary.keys() and dictionary.values()). When doing dictionary unpacking using dictionary literals the expression to be expanded g...
python.library.ast#ast.Dict
class ast.ListComp(elt, generators) class ast.SetComp(elt, generators) class ast.GeneratorExp(elt, generators) class ast.DictComp(key, value, generators) List and set comprehensions, generator expressions, and dictionary comprehensions. elt (or key and value) is a single node representing the part that will be ...
python.library.ast#ast.DictComp
class ast.Add class ast.Sub class ast.Mult class ast.Div class ast.FloorDiv class ast.Mod class ast.Pow class ast.LShift class ast.RShift class ast.BitOr class ast.BitXor class ast.BitAnd class ast.MatMult Binary operator tokens.
python.library.ast#ast.Div
ast.dump(node, annotate_fields=True, include_attributes=False, *, indent=None) Return a formatted dump of the tree in node. This is mainly useful for debugging purposes. If annotate_fields is true (by default), the returned string will show the names and the values for fields. If annotate_fields is false, the result ...
python.library.ast#ast.dump
class ast.Eq class ast.NotEq class ast.Lt class ast.LtE class ast.Gt class ast.GtE class ast.Is class ast.IsNot class ast.In class ast.NotIn Comparison operator tokens.
python.library.ast#ast.Eq
class ast.ExceptHandler(type, name, body) A single except clause. type is the exception type it will match, typically a Name node (or None for a catch-all except: clause). name is a raw string for the name to hold the exception, or None if the clause doesn’t have as foo. body is a list of nodes. >>> print(ast.dump(as...
python.library.ast#ast.ExceptHandler
class ast.Expr(value) When an expression, such as a function call, appears as a statement by itself with its return value not used or stored, it is wrapped in this container. value holds one of the other nodes in this section, a Constant, a Name, a Lambda, a Yield or YieldFrom node. >>> print(ast.dump(ast.parse('-a')...
python.library.ast#ast.Expr
ast.fix_missing_locations(node) When you compile a node tree with compile(), the compiler expects lineno and col_offset attributes for every node that supports them. This is rather tedious to fill in for generated nodes, so this helper adds these attributes recursively where not already set, by setting them to the va...
python.library.ast#ast.fix_missing_locations
class ast.Add class ast.Sub class ast.Mult class ast.Div class ast.FloorDiv class ast.Mod class ast.Pow class ast.LShift class ast.RShift class ast.BitOr class ast.BitXor class ast.BitAnd class ast.MatMult Binary operator tokens.
python.library.ast#ast.FloorDiv
class ast.For(target, iter, body, orelse, type_comment) A for loop. target holds the variable(s) the loop assigns to, as a single Name, Tuple or List node. iter holds the item to be looped over, again as a single node. body and orelse contain lists of nodes to execute. Those in orelse are executed if the loop finishe...
python.library.ast#ast.For
type_comment type_comment is an optional string with the type annotation as a comment.
python.library.ast#ast.For.type_comment
class ast.FormattedValue(value, conversion, format_spec) Node representing a single formatting field in an f-string. If the string contains a single formatting field and nothing else the node can be isolated otherwise it appears in JoinedStr. value is any expression node (such as a literal, a variable, or a functio...
python.library.ast#ast.FormattedValue
class ast.FunctionDef(name, args, body, decorator_list, returns, type_comment) A function definition. name is a raw string of the function name. args is a arguments node. body is the list of nodes inside the function. decorator_list is the list of decorators to be applied, stored outermost first (i.e. the first ...
python.library.ast#ast.FunctionDef
type_comment type_comment is an optional string with the type annotation as a comment.
python.library.ast#ast.FunctionDef.type_comment
class ast.ListComp(elt, generators) class ast.SetComp(elt, generators) class ast.GeneratorExp(elt, generators) class ast.DictComp(key, value, generators) List and set comprehensions, generator expressions, and dictionary comprehensions. elt (or key and value) is a single node representing the part that will be ...
python.library.ast#ast.GeneratorExp
ast.get_docstring(node, clean=True) Return the docstring of the given node (which must be a FunctionDef, AsyncFunctionDef, ClassDef, or Module node), or None if it has no docstring. If clean is true, clean up the docstring’s indentation with inspect.cleandoc(). Changed in version 3.5: AsyncFunctionDef is now support...
python.library.ast#ast.get_docstring
ast.get_source_segment(source, node, *, padded=False) Get source code segment of the source that generated node. If some location information (lineno, end_lineno, col_offset, or end_col_offset) is missing, return None. If padded is True, the first line of a multi-line statement will be padded with spaces to match its...
python.library.ast#ast.get_source_segment
class ast.Global(names) class ast.Nonlocal(names) global and nonlocal statements. names is a list of raw strings. >>> print(ast.dump(ast.parse('global x,y,z'), indent=4)) Module( body=[ Global( names=[ 'x', 'y', 'z'])], type_ignores=[]) >>...
python.library.ast#ast.Global
class ast.Eq class ast.NotEq class ast.Lt class ast.LtE class ast.Gt class ast.GtE class ast.Is class ast.IsNot class ast.In class ast.NotIn Comparison operator tokens.
python.library.ast#ast.Gt
class ast.Eq class ast.NotEq class ast.Lt class ast.LtE class ast.Gt class ast.GtE class ast.Is class ast.IsNot class ast.In class ast.NotIn Comparison operator tokens.
python.library.ast#ast.GtE
class ast.If(test, body, orelse) An if statement. test holds a single node, such as a Compare node. body and orelse each hold a list of nodes. elif clauses don’t have a special representation in the AST, but rather appear as extra If nodes within the orelse section of the previous one. >>> print(ast.dump(ast.parse(""...
python.library.ast#ast.If
class ast.IfExp(test, body, orelse) An expression such as a if b else c. Each field holds a single node, so in the following example, all three are Name nodes. >>> print(ast.dump(ast.parse('a if b else c', mode='eval'), indent=4)) Expression( body=IfExp( test=Name(id='b', ctx=Load()), body=Name(id...
python.library.ast#ast.IfExp
class ast.Import(names) An import statement. names is a list of alias nodes. >>> print(ast.dump(ast.parse('import x,y,z'), indent=4)) Module( body=[ Import( names=[ alias(name='x'), alias(name='y'), alias(name='z')])], type_ignores=[])
python.library.ast#ast.Import
class ast.ImportFrom(module, names, level) Represents from x import y. module is a raw string of the ‘from’ name, without any leading dots, or None for statements such as from . import foo. level is an integer holding the level of the relative import (0 means absolute import). >>> print(ast.dump(ast.parse('from y imp...
python.library.ast#ast.ImportFrom
class ast.Eq class ast.NotEq class ast.Lt class ast.LtE class ast.Gt class ast.GtE class ast.Is class ast.IsNot class ast.In class ast.NotIn Comparison operator tokens.
python.library.ast#ast.In
ast.increment_lineno(node, n=1) Increment the line number and end line number of each node in the tree starting at node by n. This is useful to “move code” to a different location in a file.
python.library.ast#ast.increment_lineno
class ast.UAdd class ast.USub class ast.Not class ast.Invert Unary operator tokens. Not is the not keyword, Invert is the ~ operator. >>> print(ast.dump(ast.parse('not x', mode='eval'), indent=4)) Expression( body=UnaryOp( op=Not(), operand=Name(id='x', ctx=Load())))
python.library.ast#ast.Invert
class ast.Eq class ast.NotEq class ast.Lt class ast.LtE class ast.Gt class ast.GtE class ast.Is class ast.IsNot class ast.In class ast.NotIn Comparison operator tokens.
python.library.ast#ast.Is
class ast.Eq class ast.NotEq class ast.Lt class ast.LtE class ast.Gt class ast.GtE class ast.Is class ast.IsNot class ast.In class ast.NotIn Comparison operator tokens.
python.library.ast#ast.IsNot
ast.iter_child_nodes(node) Yield all direct child nodes of node, that is, all fields that are nodes and all items of fields that are lists of nodes.
python.library.ast#ast.iter_child_nodes
ast.iter_fields(node) Yield a tuple of (fieldname, value) for each field in node._fields that is present on node.
python.library.ast#ast.iter_fields
class ast.JoinedStr(values) An f-string, comprising a series of FormattedValue and Constant nodes. >>> print(ast.dump(ast.parse('f"sin({a}) is {sin(a):.3}"', mode='eval'), indent=4)) Expression( body=JoinedStr( values=[ Constant(value='sin('), FormattedValue( value=...
python.library.ast#ast.JoinedStr
class ast.keyword(arg, value) A keyword argument to a function call or class definition. arg is a raw string of the parameter name, value is a node to pass in.
python.library.ast#ast.keyword
class ast.Lambda(args, body) lambda is a minimal function definition that can be used inside an expression. Unlike FunctionDef, body holds a single node. >>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4)) Module( body=[ Expr( value=Lambda( args=arguments( ...
python.library.ast#ast.Lambda
class ast.List(elts, ctx) class ast.Tuple(elts, ctx) A list or tuple. elts holds a list of nodes representing the elements. ctx is Store if the container is an assignment target (i.e. (x,y)=something), and Load otherwise. >>> print(ast.dump(ast.parse('[1, 2, 3]', mode='eval'), indent=4)) Expression( body=List( ...
python.library.ast#ast.List
class ast.ListComp(elt, generators) class ast.SetComp(elt, generators) class ast.GeneratorExp(elt, generators) class ast.DictComp(key, value, generators) List and set comprehensions, generator expressions, and dictionary comprehensions. elt (or key and value) is a single node representing the part that will be ...
python.library.ast#ast.ListComp
ast.literal_eval(node_or_string) Safely evaluate an expression node or a string containing a Python literal or container display. The string or node provided may only consist of the following Python literal structures: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and None. This can be used for safel...
python.library.ast#ast.literal_eval
class ast.Load class ast.Store class ast.Del Variable references can be used to load the value of a variable, to assign a new value to it, or to delete it. Variable references are given a context to distinguish these cases. >>> print(ast.dump(ast.parse('a'), indent=4)) Module( body=[ Expr( ...
python.library.ast#ast.Load
class ast.Add class ast.Sub class ast.Mult class ast.Div class ast.FloorDiv class ast.Mod class ast.Pow class ast.LShift class ast.RShift class ast.BitOr class ast.BitXor class ast.BitAnd class ast.MatMult Binary operator tokens.
python.library.ast#ast.LShift
class ast.Eq class ast.NotEq class ast.Lt class ast.LtE class ast.Gt class ast.GtE class ast.Is class ast.IsNot class ast.In class ast.NotIn Comparison operator tokens.
python.library.ast#ast.Lt
class ast.Eq class ast.NotEq class ast.Lt class ast.LtE class ast.Gt class ast.GtE class ast.Is class ast.IsNot class ast.In class ast.NotIn Comparison operator tokens.
python.library.ast#ast.LtE
class ast.Add class ast.Sub class ast.Mult class ast.Div class ast.FloorDiv class ast.Mod class ast.Pow class ast.LShift class ast.RShift class ast.BitOr class ast.BitXor class ast.BitAnd class ast.MatMult Binary operator tokens.
python.library.ast#ast.MatMult
class ast.Add class ast.Sub class ast.Mult class ast.Div class ast.FloorDiv class ast.Mod class ast.Pow class ast.LShift class ast.RShift class ast.BitOr class ast.BitXor class ast.BitAnd class ast.MatMult Binary operator tokens.
python.library.ast#ast.Mod
class ast.Add class ast.Sub class ast.Mult class ast.Div class ast.FloorDiv class ast.Mod class ast.Pow class ast.LShift class ast.RShift class ast.BitOr class ast.BitXor class ast.BitAnd class ast.MatMult Binary operator tokens.
python.library.ast#ast.Mult
class ast.Name(id, ctx) A variable name. id holds the name as a string, and ctx is one of the following types.
python.library.ast#ast.Name
class ast.NamedExpr(target, value) A named expression. This AST node is produced by the assignment expressions operator (also known as the walrus operator). As opposed to the Assign node in which the first argument can be multiple nodes, in this case both target and value must be single nodes. >>> print(ast.dump(ast....
python.library.ast#ast.NamedExpr