Steve R. Hastings wrote: > If Python actually allocates the list, then clearly we should all use > "for i in xrange".
clearly we should all? speak for yourself. the difference isn't very large, xrange is actually slower in some python versions, and you'll need the integer objects sooner or later anyway... > If Python doesn't currently optimize this case, is there any chance this > optimization could be added? in Python 2.X, range is defined to return a list. if you start returning something else, you'll break stuff. </F> -- http://mail.python.org/mailman/listinfo/python-list