Sep-26-2022, 05:19 PM
suppose i have a generator named g(). i create a function named f() that when called with keyword argument gen=True will call g(*args,**kwargs) and return whatever it gets. can f() be used like a generator when give that keyword argument?
i want to have a single API function that can be a regular function or a generator depending on a given argument.
i want to have a single API function that can be a regular function or a generator depending on a given argument.