Рет қаралды 138,186
Any Python for loop can be written without using "for".
Seeing how to do this rewrite is the key to understanding how iteration fundamentally works in Python.
Note: PLEASE, DO NOT REPLACE YOUR FOR LOOPS. This video is strictly for understanding what happens under the hood with iter/next/StopIteration stuff under the hood in CPython.
Errata:
- Not all for loops raise a StopIteration, only the ones that stop do, i.e. not infinite loops.
― mCoding with James Murphy (mcoding.io)
Source code: github.com/mCodingLLC/VideosS...
SUPPORT ME ⭐
---------------------------------------------------
Patreon: / mcoding
Paypal: www.paypal.com/donate/?hosted...
Other donations: mcoding.io/donate
Top patrons and donors: Jameson, Laura M, Vahnekie, Dragos C, Matt R, Casey G, Johan A, John Martin, Jason F, Mutual Information, Neel R
BE ACTIVE IN MY COMMUNITY 😄
---------------------------------------------------
Discord: / discord
Github: github.com/mCodingLLC/
Reddit: / mcoding
Facebook: / james.mcoding
MUSIC
---------------------------------------------------
Local Elevator by Kevin MacLeod is licensed under a Creative Commons Attribution 4.0 license. creativecommons.org/licenses/...
Source: incompetech.com/music/royalty-...
Artist: incompetech.com/