synt.stmt.loop
¤
ForLoop
¤
Bases: Statement
The for loop.
Examples:
References
For.
Source code in synt/stmt/loop.py
target
instance-attribute
¤
|
Target item for the iteration.
Notes
Tuples will be automatically unwrapped.
orelse
instance-attribute
¤
The body of the fallback block, aka for ... else.
__init__
¤
|
Initialize the loop.
DO NOT USE THIS IN YOUR CODE!
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target |
IntoExpression
|
Target item for the iteration. |
required |
it |
IntoExpression
|
The expression to iterate over. |
required |
body |
Block
|
The body of the loop. |
required |
Source code in synt/stmt/loop.py
else_
¤
Set the fallback else block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
statements |
Statement
|
The body of the fallback block. |
()
|
indented
¤
Source code in synt/stmt/loop.py
ForLoopBuilder
¤
Builder for for loop.
References
Source code in synt/stmt/loop.py
__init__
¤
|
Initialize a new for loop builder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target |
IntoExpression
|
Target item for the iteration. |
required |
in_
¤
|
Set the iterator of the loop.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
it |
IntoExpression
|
The expression to iterate over. |
required |
block
¤
Set the block of the loop.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*statements |
Statement
|
Statements to include in the loop body. |
()
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the required fields ( |
Source code in synt/stmt/loop.py
WhileLoop
¤
The while loop.
References
Source code in synt/stmt/loop.py
orelse
instance-attribute
¤
The body of the fallback block, aka while ... else.
__init__
¤
|
Initialize a new while loop.
DO NOT USE THIS IN YOUR CODE!
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
test |
IntoExpression
|
The condition. |
required |
body |
Block
|
The body of the loop. |
required |
Source code in synt/stmt/loop.py
else_
¤
Set the fallback else block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
statements |
Statement
|
The body of the fallback block. |
()
|
indented
¤
Source code in synt/stmt/loop.py
WhileLoopBuilder
¤
Builder for while loop.
Examples:
References
Source code in synt/stmt/loop.py
__init__
¤
|
Initialize a new while loop builder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
test |
IntoExpression
|
The condition. |
required |