Return the value of the expression as constant or raise :exc:`Impossible` if this was not possible. An :class:`EvalContext` can be provided, if none is given a default context is created which requires the nodes to have an attached environment. .. versioncha
(self, eval_ctx: t.Optional[EvalContext] = None)
| 468 | abstract = True |
| 469 | |
| 470 | def as_const(self, eval_ctx: t.Optional[EvalContext] = None) -> t.Any: |
| 471 | """Return the value of the expression as constant or raise |
| 472 | :exc:`Impossible` if this was not possible. |
| 473 | |
| 474 | An :class:`EvalContext` can be provided, if none is given |
| 475 | a default context is created which requires the nodes to have |
| 476 | an attached environment. |
| 477 | |
| 478 | .. versionchanged:: 2.4 |
| 479 | the `eval_ctx` parameter was added. |
| 480 | """ |
| 481 | raise Impossible() |
| 482 | |
| 483 | def can_assign(self) -> bool: |
| 484 | """Check if it's possible to assign something to this node.""" |