+ 12

Python: return vs yield‌

Who can explain⁉ def fun(): return 1 print(fun()) def gen(): return 2 # didn't work yield 3 print(gen()) OUTPUT 1 <generator object gen at ...... > # But why❓❓❓

21st Jan 2018, 10:58 AM
Janusz Bujak đŸ‡”đŸ‡±
Janusz Bujak đŸ‡”đŸ‡± - avatar
1 Answer
21st Jan 2018, 12:29 PM
Ferhat Sevim
Ferhat Sevim - avatar