Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
cassidyb
6,908 PointsIsn't enumerate a very inefficient way to get a simple loop counter? What if you're using a large dataset 10,000 times?
It just seems that calling a function during each loop iteration (a function that returns an object, no less) is too much when you could store a local variable and increment it?
1 Answer

Travis Alstrand
Treehouse StaffHey cassidyb !
To be honest, I haven't built anything using numbers like this yet so I started Googling
According to this Geeks for Geeks page, it's just adding a counter to an iterable.
According to this python-reference page, it's returning an enumerate object like you said.
This article has some alternatives if you find yourself in this situation and performance does in fact start getting noticeably worse.