pytools.expression.composite.ListLiteral#

class pytools.expression.composite.ListLiteral(*elements)[source]#

A list expression.

Bases:

CollectionLiteral

Metaclasses:

ABCMeta

Parameters:

elements (Any) – the list elements

Method summary

and_

Create a logical and expression using this and another expression as operands.

eq_

Compare this expression with another for equality.

hash_

Calculate the hash code for this expression.

not_

Create a logical not expression using this expression as the operand.

or_

Create a logical or expression using this and another expression as operands.

to_expression

Render this object as an expression.

Attribute summary

brackets_

The brackets enclosing this expression's subexpressions.

elements_

The expression(s) representing the elements of this expression.

precedence_

The precedence of this expression, used to determine the need for parentheses.

subexpression_

The subexpression representing the element(s) of this collection literal

subexpressions_

A tuple with this expression's subexpression as its only element.

Definitions

__call__(*args, **kwargs)#

Generate a Call expression.

Return type:

Expression

Returns:

the resulting expression

and_(other)#

Create a logical and expression using this and another expression as operands.

Parameters:

other (Expression) – other operand to combine with this expression using a logical and

Return type:

Expression

Returns:

the logical and expression

eq_(other)#

Compare this expression with another for equality.

For using Python’s native equality operator ==, see FrozenExpression.

Parameters:

other (Expression) – the expression to compare this expression with

Return type:

bool

Returns:

True if both expressions are equal; False otherwise

hash_()#

Calculate the hash code for this expression.

For using Python’s native hash function, see FrozenExpression.

Return type:

int

Returns:

the hash code for this expression

not_()#

Create a logical not expression using this expression as the operand.

Return type:

Expression

Returns:

the logical not expression

or_(other)#

Create a logical or expression using this and another expression as operands.

Parameters:

other (Expression) – other operand to combine with this expression using a logical or

Return type:

Expression

Returns:

the logical or expression

to_expression()#

Render this object as an expression.

Return type:

Expression

Returns:

the expression representing this object

property brackets_: BracketPair#

The brackets enclosing this expression’s subexpressions.

property elements_: tuple[Expression, ...]#

The expression(s) representing the elements of this expression.

property precedence_: int#

The precedence of this expression, used to determine the need for parentheses.

property subexpression_: Expression#

The subexpression representing the element(s) of this collection literal

property subexpressions_: tuple[Expression, ...]#

A tuple with this expression’s subexpression as its only element.