"Kent Johnson" <[EMAIL PROTECTED]> wrote

> possible = set(xrange(4, 1000, 4)).intersection(xrange(5, 1000, 5)) 
> \
>             .intersection(xrange(6, 1000, 6))
>

Kent,

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
wrong?

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
a function.

I suspect I'm missing something! :-)

Alan G 


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to