int vs long

Peter Otten __peter__ at web.de
Mon Jun 4 03:44:16 EDT 2007


Paul Rubin wrote:

> Dan Bishop <danb_83 at yahoo.com> writes:
>> If you ever do, it's trivial to write your own enumerate():
>> def enumerate(seq):
>>     index = 0
>>     for item in seq:
>>         yield (index, item)
>>         index += 1
> 
> That's a heck of a lot slower than the builtin, and if you're running it
> often enough for sys.maxint to be an issue, you may care about the speed.

Yes, but the overall slowdown is probably still negligable when you are
doing anything useful inside the for loop.

Peter



More information about the Python-list mailing list