set_transaction#
- NodeTree.set_transaction() Generator[None, None, None] [source]#
Context manager for a transactional set.
Can be used as a context in a with statement and bundles all node set commands into a single transaction. This reduces the network overhead and often increases the speed.
Within the with block all set commands to a node will be buffered and grouped into a single command at the end of the context automatically. (All other operations, e.g. getting the value of a node, will not be affected)
Warning
The set is always performed as deep set if called on device nodes.
Examples
>>> with nodetree.set_transaction(): nodetree.test[0].a(1) nodetree.test[1].a(2)
- Return type:
Generator[None, None, None]