[Tutor] Off Topic: xrange, WAS: Re: the and command
alan.gauld at btinternet.com
Fri Aug 24 15:32:40 CEST 2007
"Kent Johnson" <kent37 at tds.net> wrote
> possible = set(xrange(4, 1000, 4)).intersection(xrange(5, 1000, 5))
> .intersection(xrange(6, 1000, 6))
I've noticed in a few of your replie recemntly you have been using
xrange rather than range. I was under the impression that since
iterators were introduced that xrange was more or less just an
alias for range. Your usage suggests that my understanding is
However, even in its original incarnation I would not have used it
here since I thought its main advantage was in loops where it
(like a geneator) yielded values one by one to save memory.
In this case aren't you generating the full set in each case?
Or at least in the first case, the set()?
I notice that help() still differentiates between the two,
and indeed that xrange purports to be a type rather than
I suspect I'm missing something! :-)
More information about the Tutor