If I use enumerate while iterating through a very large list of graph clusters, I want to make sure I'm not unnecessarily creating any copies of this list in memory.
I've been trying to confirm that it will not create any copies, but would like to know for sure.
for i, cluster in enumerate(c):
# code that does stuff with i and cluster
No, it doesn't. It lazily iterates the iterable you pass in while the loop executes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With