0
Return in generator
Why doesn’t return work in a generator function. In the code here, when randint returns 1, my function returns nothing, not even none. It is strange, but I guess it just yields an empty generator iterator in that case? https://code.sololearn.com/c0kHQ2sm3i8w/?ref=app
3 Respostas
+ 2
Here, you can read what will be happen on a return in a generator function.
In short words: The call will not get the return value. The "normal" use of return in this case, is to use it w/o any argument.
https://stackoverflow.com/questions/26595895/return-and-yield-in-the-same-function
+ 1
Thank you coding cat
+ 1
Edward Finkelstein you are welcome. It was also interesting for me, to find out what was going on here 😉