[Tutor] Looping

Alan Gauld alan.gauld at btinternet.com
Mon Apr 20 23:34:41 CEST 2009


"Matt" <HellZFury+Python at gmail.com> wrote

> As an aside, why use range rather than xrange? I was under the impression
> that xrange is a generator and therefore more memory efficient.

xrange was a kludge to improve on range's memory efficiency
but it is a horrible name that obscures the code.

Also it does not exist in v3 so if you use it you will need to change
the code for v3. It is as well to be as consistent with v3 as possible
IMHO

Alan G







More information about the Tutor mailing list