class documentation

class LocalStack:

View In Hierarchy

This class works similar to a Local but keeps a stack of objects instead. This is best explained with an example:

>>> ls = LocalStack()
>>> ls.push(42)
>>> ls.top
42
>>> ls.push(23)
>>> ls.top
23
>>> ls.pop()
23
>>> ls.top
42

They can be force released by using a LocalManager or with the release_local function but the correct way is to pop the item from the stack after using. When the stack is empty it will no longer be bound to the current context (and as such released).

By calling the stack without arguments it returns a proxy that resolves to the topmost item on the stack.

New in version 0.6.1.
Method __call__ Undocumented
Method __init__ Undocumented
Method __release​_local__ Undocumented
Method pop Removes the topmost item from the stack, will return the old value or None if the stack was already empty.
Method push Pushes a new item to the stack
Property __ident​_func__ Undocumented
Property top The topmost item on the stack. If the stack is empty, None is returned.
Method __ident​_func​_​_.setter Undocumented
Instance Variable ​_local Undocumented
def __call__(self):

Undocumented

Returns
LocalProxyUndocumented
def __init__(self):

Undocumented

def __release_local__(self):

Undocumented

def pop(self):
Removes the topmost item from the stack, will return the old value or None if the stack was already empty.
Returns
t.AnyUndocumented
def push(self, obj):
Pushes a new item to the stack
Parameters
obj:t.AnyUndocumented
Returns
t.List[t.Any]Undocumented
@property
__ident_func__: t.Callable[[], int] =

Undocumented

@property
top: t.Any =
The topmost item on the stack. If the stack is empty, None is returned.
@__ident_func__.setter
def __ident_func__(self, value):

Undocumented

Parameters
value:t.Callable[[], int]Undocumented
_local =

Undocumented