+ 3
yield is very similar to return but instead of terminating the generator function, it only suspends it until the next value is retrieved from the generator. Generators are awesome when you have to work with large amounts of data, and you don't want to load all of it to memory, you process it piece by piece. This is called "lazy evaluation". https://realpython.com/introduction-to-JUMP_LINK__&&__python__&&__JUMP_LINK-generators/
22nd Apr 2020, 7:13 PM
Tibor Santa
Tibor Santa - avatar