temporary_namespace¶
-
utilipy.utils.temporary_namespace(locals_ref, keep: List[str] = [])[source]¶ Temporary Namespace within
withstatement.copies current namespace from
locals_refEnters
withstatementrestores original namespace except those specified in
keep
- Parameters
- modulemodule
sys.modules[__name__]of module calling from.Todo
not need to pass any module information. infer.
- keeplist, optional
list of (str) variable names to keep.
- Yields
- locals_reflocals
for accessing namespace
Warning
Does NOT work within functions.