language-x-isms
Terry Reedy
tjreedy at udel.edu
Thu Jun 8 04:02:28 EDT 2006
"astyonax" <astyonax at libero.it> wrote in message
news:1149753206.451066.120960 at h76g2000cwa.googlegroups.com...
>
> Fredrik Lundh wrote:
>> Bryan wrote:
>>
>> > for example, i've noticed several java developers i know
>> > write python code like
>> > this:
>> >
>> > foo_list = [...]
>> > for i in range(len(foo_list)):
>> > print '%d %s' % (i, foo_list[i])
>>
>> which is a perfectly valid way of doing things if you're targeting older
>> Python platforms as well (including Jython).
>>
>> </F>
>
> But it's not the pythonic way.
I don't think you understood what Fredrik said. It was the Python way
before enumerate() builtin was added and remains the Python way if you wish
to write for older versions of Python and Jython. I don't do either but
respect those who do, sometimes not exactly by choice. Ultimately, the
'pythonic' way is to do something that works rather than nothing at all.
Terry Jan Reedy
More information about the Python-list
mailing list