3 ms·
I consider myself somewhere in the spectrum between beginner and intermediate and I use enumeration quite often. I picked it up early on in a tutorial by Andrew
by heyalexej 11y ago
I consider myself somewhere in the spectrum between beginner and intermediate and I use enumeration quite often. I picked it up early on in a tutorial by Andrew Montalenti (founder of http://www.parsely.com http://www.parsely.com and quite active in the Python community) and use it ever since instead of wrapping it into another loop like beginner tutorials teach you. For example if I need to read in a file with 5 million lines but for debugging or performance optimization reasons want to break the loop after 1K lines.
- p1esk 11y agoAll beginner tutorials I used introduced "enumerate" early on. Indexing is probably the first thing you're wondering about when you start coding in Python after coding in C.