python loops

stdazi stdazi at
Fri Sep 1 11:34:48 CEST 2006

`range' is especially useful for iterating over long sequences ;-)

    for i in range(0,100000000000000) :
OverflowError: range() result has too many items

Sybren Stuvel wrote:
> Michael.Coll-Barth at enlightened us with:
> > I thought the xrange was preferred?  for x in xrange(length):
> True. It doesn't create the entire list, like range does. range(1000)
> creates a 1000-element list. xrange(1000) just iterates through the
> appropirate values.
> > The information contained in this message and any attachment may be
> > proprietary, confidential, and privileged or subject to the work
> > product doctrine and thus protected from disclosure.  If the reader
> > of this message is not the intended recipient, or an employee or
> > agent responsible for delivering this message to the intended
> > recipient, you are hereby notified that any dissemination,
> > distribution or copying of this communication is strictly
> > prohibited.  If you have received this communication in error,
> > please notify me immediately by replying to this message and
> > deleting it and all copies and backups thereof.  Thank you.
> And how are we supposed to interpret this? Copying this communication
> may be prohibited, but both email and usenet messages are copied all
> the time. Without that, both systems fail miserably.
> Sybren
> --
> The problem with the world is stupidity. Not saying there should be a
> capital punishment for stupidity, but why don't we just take the
> safety labels off of everything and let the problem solve itself?
>                                              Frank Zappa

More information about the Python-list mailing list