Re:Just why did people start using Python anyway?
by abstractbill on Thursday October 09, 2008 @11:20AM
(#327889)
That's not a good idiom, because it only allows you to loop over small ranges:
Why attempt to allocate such a large list when you just want to do something several times?
[ Parent
| on HN ]
Re:Just why did people start using Python anyway?
by oofoe on Thursday October 09, 2008 @12:33PM
(#327965)
for i in xrange(1000000000): print i
xrange() addresses the problem you describe and has been in Python since, like, forever. However, range() is nicer for learning the language, since it's easy to see how it composes into a list.
Re:Just why did people start using Python anyway?
by abstractbill on Thursday October 09, 2008 @12:41PM
(#327977)
Yes, I know. It's just bad that people are taught one way of iterating, and then may or may not learn the right way at some later time.