0

Does generator create the list first or it returns by demand?

16th Sep 2016, 2:08 AM
mohsen jamali
mohsen jamali - avatar
1 Odpowiedź
+ 2
Second. The great power of generators - that we don't need to wait until it create all it's values. Generator creates next value in real-time. This allow us to deal with sequences of values which are infinite (f.e Fibonacci numbers or prime numbers), which we can't do using iterable objects, like lists, sets, dictionaries etc.
16th Sep 2016, 2:30 AM
Textobot
Textobot - avatar