[EMAIL PROTECTED] wrote:

> I thought the xrange was preferred?  for x in xrange(length):

preferred by premature optimization freaks, perhaps.  in practice, if the
range is reasonably small and you're going to loop over all the integers,
it doesn't really matter.

(the range form creates a list and N integers up front; the xrange form
creates an iterator object up front and N integers while you're looping.
what's faster depends on what Python version you're using, and some-
times also on the phase of the moon)

in Python 3.0, xrange() will disappear, and range() will return an iterator
instead.

</F> 



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to