Thursday, August 31, 2017

range and xrange

http://www.geeksforgeeks.org/range-vs-xrange-python/


range() – This returns a list of numbers created using range() function.
xrange() – This function returns the generator object that can be used to display numbers only by looping. Only particular range is displayed on demand and hence called “lazy evaluation“.

memory used for xrange is much less compared to range


No comments:

Post a Comment