Hello,
PerformanceTips is detailed and useful for python developer, where I have
improved myself a lot. In the learning, I found a question in “Use xrange
instead of range” section about the example code below:
def xrange(start, stop=None, step=1):
if stop is None:
stop = start
start = 0
else:
stop = int(stop)
start = int(start)
step = int(step)
while start < stop:
yield start
start += step
The example code run type conversion only under the case that the stop
variable is not None, so, if I run code ”xrange('5’)", the code can not work.
I have no authorization to edit this page, and by the way, wiki.python.org
is too hard to register. it will help more people who have interesting in
python if you spend time to check the code and correct it.
Best wish.
_______________________________________________
pydotorg-www mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pydotorg-www