Re: simulate enumerate in python 2.1

2006-07-10 Thread John Machin
On 11/07/2006 2:30 AM, [EMAIL PROTECTED] wrote: > hi, > i am using python 2.1. Can i use the code below to simulate the > enumerate() function in 2.3? I'm bemused, boggled and bamboozled -- and that's just *one* letter of the alphabet ... You are using Python 2.1, and you felt it necessary to as

Re: simulate enumerate in python 2.1

2006-07-10 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > hi, > i am using python 2.1. Can i use the code below to simulate the > enumerate() function in 2.3? If not, how to simulate in 2.1? > thanks > > from __future__ import generators > def enumerate(sequence): >index = 0 >for item

simulate enumerate in python 2.1

2006-07-10 Thread eight02645999
hi, i am using python 2.1. Can i use the code below to simulate the enumerate() function in 2.3? If not, how to simulate in 2.1? thanks from __future__ import generators def enumerate(sequence): index = 0 for item in sequence: yield index, item index += 1 -- http://mail.p