liveness_scope

liveness_scope is a Python method for creating and opening a LivenessScope for running a block of code. Use this function to wrap a block of code using a with statement. For the duration of the with block, the liveness scope will be open and any liveness referents created will be automatically managed by it.

Syntax

Parameters

None.

Returns

A LivenessScope.

Examples

The method can be used in a with block to encapsulate code that produces ticking data. In the example below, table is explicitly preserved outside of the with block. ticking_table is cleaned up once the with block is exited.

It can also be used as a decorator to achieve a similar result.