ContextStack

class tfsnippet.utils.ContextStack(initial_factory=None)

Bases: object

A thread-local context stack for general purpose.

Usage:

stack = ContextStack()
stack.push(dict())  # push an object to the top of thread local stack
stack.top()[key] = value  # use the top object
stack.pop()  # pop an object from the top of thread local stack

Attributes Summary

items

Methods Summary

pop()
push(context)
top()

Attributes Documentation

items

Methods Documentation

pop()
push(context)
top()