Sunteți pe pagina 1din 1

Python 3.3 of range has actually been back ported to python 2.7 and it is xrange() in python 2.

Benefits in new range() function in python 3.3 is when you do something like in Python 3.3 and you
say range(1,10000000000000000) , what its going to do in python 2.7 is literally generated a list that
is this from 1 to this number or whatever it is and obviously thats going to use a lot of you virtual
memory so your RAM and its probably going to max out you RAM before it completes the operation
but in Python 3.3 if you use whats called xrange in python 2.7, it turns this into whats known as a
generator, what it does is it only visits that operation once it doesnt store it in the memory but it
will count through.

S-ar putea să vă placă și