Run a generator function to exhaustion and return its yields as a list.
A method that yields each answer as it finds it is returned whole, the way
LeetCode expects it.
Source code in pydsa/generators.mu
8 910111213141516
defas_list(f:Callable[...,Iterator[T]])->Callable[...,[T]]"""Run a generator function to exhaustion and return its yields as a list. A method that yields each answer as it finds it is returned whole, the way LeetCode expects it. """@wraps(f)defwrapper(*args,**kwargs)->[T]:list(f(*args,**kwargs))wrapper
8 91011121314151617
defas_list(f:Callable[...,Iterator[T]])->Callable[...,list[T]]:"""Run a generator function to exhaustion and return its yields as a list. A method that yields each answer as it finds it is returned whole, the way LeetCode expects it. """@wraps(f)defwrapper(*args,**kwargs)->list[T]:returnlist(f(*args,**kwargs))returnwrapper