xrange questioin
Chris Liechti
cliechti at gmx.net
Sat Jul 27 19:49:34 EDT 2002
More information about the Python-list mailing list
Sat Jul 27 19:49:34 EDT 2002
- Previous message (by thread): xrange questioin
- Next message (by thread): xrange questioin
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Gerald Squelart" <squelart at hotmail.nospam.com> wrote in news:3d43234e$1 at duster.adelaide.on.net: > "Chris Liechti" <cliechti at gmx.net> wrote: >> Uwe Schmitt <uwe.schmitt at procoders.net> wrote: >> > as xrange() comsumes less memory than range() I ask why >> > I should use range() at all.... is there any benifit >> > from using range() ??? >> >> with range you get a true list which you can manipulate, sort, >> reverse, etc ... you can't do that with xrange. >> >> chris >> >> -- >> Chris <cliechti at gmx.net> > > Ok, let me rephrase Chris' question for a simpler case: it wasn't my question... but i'll try to answer yours > What is better: for x in range(n) or for x in xrange(n)? > (with n is relatively small, like 10 or 100) that depends on your definition of "better" ;-) considering speed, "range" is slightly faster for small n chris -- Chris <cliechti at gmx.net>
- Previous message (by thread): xrange questioin
- Next message (by thread): xrange questioin
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list