FunPython: Function-generator
Lazy function
Oct 2, 2022
A function in Python cannot be a generator and a normal function at the same time. If the word yield is specified, the function becomes a generator:
You can solve this problem by putting the generator in a separate function:
If the generator is simple, you can use generator expressions:
Here’s a little tip for you. If you like it, please support me by giving me a “Like”. It’s important to me. 😻