a proxy function for a generator - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: General (https://python-forum.io/forum-1.html) +--- Forum: News and Discussions (https://python-forum.io/forum-31.html) +--- Thread: a proxy function for a generator (/thread-38297.html) |
a proxy function for a generator - Skaperen - Sep-26-2022 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. |