# expressions

URL: /kida/api/nodes/expressions/
Section: nodes
Description: Expression nodes for Kida AST.

---

> For a complete page index, fetch /kida/llms.txt.

Open LLM text
(/kida/api/nodes/expressions/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fnodes%2Fexpressions%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fnodes%2Fexpressions%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fnodes%2Fexpressions%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fnodes%2Fexpressions%2Findex.txt)

Module

#
`nodes.expressions`

Expression nodes for Kida AST.

30Classes

## Classes

`Expr`

0

▼

Base class for expressions.

Base class for expressions.

`Const`

1

▼

Constant value: string, number, boolean, None.

Constant value: string, number, boolean, None.

#### Attributes

Name
Type
Description

`value`

`str | int | float | bool | None`

—

`Name`

2

▼

Variable reference: {{ user }}

Variable reference: {{ user }}

#### Attributes

Name
Type
Description

`name`

`str`

—

`ctx`

`Literal['load', 'store', 'del']`

—

`Tuple`

2

▼

Tuple expression: (a, b, c)

Tuple expression: (a, b, c)

#### Attributes

Name
Type
Description

`items`

`Sequence[Expr]`

—

`ctx`

`Literal['load', 'store']`

—

`List`

1

▼

List expression: [a, b, c]

List expression: [a, b, c]

#### Attributes

Name
Type
Description

`items`

`Sequence[Expr]`

—

`ListComp`

4

▼

List comprehension: [expr for x in iterable if cond]

List comprehension: [expr for x in iterable if cond]

#### Attributes

Name
Type
Description

`elt`

`Expr`

—

`target`

`Expr`

—

`iter`

`Expr`

—

`ifs`

`Sequence[Expr]`

—

`Dict`

2

▼

Dict expression: {a: b, c: d}

Dict expression: {a: b, c: d}

#### Attributes

Name
Type
Description

`keys`

`Sequence[Expr]`

—

`values`

`Sequence[Expr]`

—

`Getattr`

2

▼

Attribute access: obj.attr

Attribute access: obj.attr

#### Attributes

Name
Type
Description

`obj`

`Expr`

—

`attr`

`str`

—

`OptionalGetattr`

2

▼

Optional attribute access: obj?.attr

Optional attribute access: obj?.attr

#### Attributes

Name
Type
Description

`obj`

`Expr`

—

`attr`

`str`

—

`Getitem`

2

▼

Subscript access: obj[key]

Subscript access: obj[key]

#### Attributes

Name
Type
Description

`obj`

`Expr`

—

`key`

`Expr`

—

`OptionalGetitem`

2

▼

Optional subscript access: obj?[key]

Optional subscript access: obj?[key]

#### Attributes

Name
Type
Description

`obj`

`Expr`

—

`key`

`Expr`

—

`Slice`

3

▼

Slice expression: [start:stop:step]

Slice expression: [start:stop:step]

#### Attributes

Name
Type
Description

`start`

`Expr | None`

—

`stop`

`Expr | None`

—

`step`

`Expr | None`

—

`FuncCall`

5

▼

Function call: func(args, **kwargs)

Function call: func(args, **kwargs)

#### Attributes

Name
Type
Description

`func`

`Expr`

—

`args`

`Sequence[Expr]`

—

`kwargs`

`dict[str, Expr]`

—

`dyn_args`

`Expr | None`

—

`dyn_kwargs`

`Expr | None`

—

`Filter`

5

▼

Filter application: expr | filter(args)

Filter application: expr | filter(args)

#### Attributes

Name
Type
Description

`value`

`Expr`

—

`name`

`str`

—

`args`

`Sequence[Expr]`

—

`kwargs`

`dict[str, Expr]`

—

`parenthesized`

`bool`

—

`Pipeline`

2

▼

Pipeline operator: expr |> filter1 |> filter2

Pipeline operator: expr |> filter1 |> filter2

#### Attributes

Name
Type
Description

`value`

`Expr`

—

`steps`

`Sequence[tuple[str, Sequence[Expr], dict[str, Expr]]]`

—

`SafePipeline`

0

▼

Safe pipeline: expr ?|> filter1 ?|> filter2 (None-propagating)

Inherits from Pipeline so purity an…

Safe pipeline: expr ?|> filter1 ?|> filter2 (None-propagating)

Inherits from Pipeline so purity analysis treats it identically.

`OptionalFilter`

0

▼

Optional filter: expr ?| filter(args) — skips if value is None

Inherits from Filter so purity anal…

Optional filter: expr ?| filter(args) — skips if value is None

Inherits from Filter so purity analysis treats it identically.

`Test`

5

▼

Test application: expr is test(args) or expr is not test(args)

Test application: expr is test(args) or expr is not test(args)

#### Attributes

Name
Type
Description

`value`

`Expr`

—

`name`

`str`

—

`args`

`Sequence[Expr]`

—

`kwargs`

`dict[str, Expr]`

—

`negated`

`bool`

—

`BinOp`

3

▼

Binary operation: left op right

Binary operation: left op right

#### Attributes

Name
Type
Description

`op`

`str`

—

`left`

`Expr`

—

`right`

`Expr`

—

`UnaryOp`

2

▼

Unary operation: op operand

Unary operation: op operand

#### Attributes

Name
Type
Description

`op`

`str`

—

`operand`

`Expr`

—

`Compare`

3

▼

Comparison: left op1 right1 op2 right2 ...

Comparison: left op1 right1 op2 right2 ...

#### Attributes

Name
Type
Description

`left`

`Expr`

—

`ops`

`Sequence[str]`

—

`comparators`

`Sequence[Expr]`

—

`BoolOp`

2

▼

Boolean operation: expr1 and/or expr2

Boolean operation: expr1 and/or expr2

#### Attributes

Name
Type
Description

`op`

`Literal['and', 'or']`

—

`values`

`Sequence[Expr]`

—

`CondExpr`

3

▼

Conditional expression: a if cond else b

Conditional expression: a if cond else b

#### Attributes

Name
Type
Description

`test`

`Expr`

—

`if_true`

`Expr`

—

`if_false`

`Expr`

—

`NullCoalesce`

2

▼

Null coalescing: a ?? b

Null coalescing: a ?? b

#### Attributes

Name
Type
Description

`left`

`Expr`

—

`right`

`Expr`

—

`Range`

4

▼

Range literal: start..end or start...end

Range literal: start..end or start...end

#### Attributes

Name
Type
Description

`start`

`Expr`

—

`end`

`Expr`

—

`inclusive`

`bool`

—

`step`

`Expr | None`

—

`Await`

1

▼

Await expression: await expr

Await expression: await expr

#### Attributes

Name
Type
Description

`value`

`Expr`

—

`Concat`

1

▼

String concatenation: a ~ b ~ c

String concatenation: a ~ b ~ c

#### Attributes

Name
Type
Description

`nodes`

`Sequence[Expr]`

—

`MarkSafe`

1

▼

Mark expression as safe (no escaping): {{ expr | safe }}

Mark expression as safe (no escaping): {{ expr | safe }}

#### Attributes

Name
Type
Description

`value`

`Expr`

—

`LoopVar`

1

▼

Loop variable access: {{ loop.index }}

Loop variable access: {{ loop.index }}

#### Attributes

Name
Type
Description

`attr`

`str`

—

`InlinedFilter`

3

▼

Inlined filter as direct method call (optimization).

Inlined filter as direct method call (optimization).

#### Attributes

Name
Type
Description

`value`

`Expr`

—

`method`

`str`

—

`args`

`Sequence[Expr]`

—
