sciai.utils.lazy_func

View Source On Gitee
sciai.utils.lazy_func(func, *args, **kwargs)[source]

Fabricate a lazy function which can be directly called later without arguments.

Parameters
  • func (Callable) – The function to be lazily loaded.

  • *args (any) – All non-keyword arguments for func.

  • **kwargs (any) – All keyword arguments for func.

Returns

Function, the fabricateed lazy function without arguments.

Examples

>>> from sciai.utils import lazy_func
>>> def funct(a):
>>>     print(a)
>>> lazy_f = lazy_func(funct, "printing")
>>> lazy_f()
printing