PEP 284, Integer for-loops

James_Althoff at i2.com James_Althoff at i2.com
Mon Mar 11 18:48:32 EST 2002


(Please excuse the top-posting).

I did notice the wink.  I should have acknowledged it.  Sorry.

I just thought it might be useful to show an application domain in which
using indices seems pretty natural.

I like all the points you make below.  Sorry for the confusion.

Jim

================================

> [Tim Legant]
> > So either Jason and I are significantly better than you and your
> > team at expressing ourselves naturally in Python <wink> or it's
> > the need to interface with Java that's forcing you to use integer
> > indices all the time.  I'm betting big money on the latter.
>
> I'm happy to believe you all are excellent programmers versed in Pythonic
> ways.  And I'm always happy to learn something new.  So feel free to help
> me on this one.

Hmmm.  Did you by any chance miss my <wink>?

My intent was to provide a supporting data point to your hypothesis
that the real issue is interfacing with Java.  With Python as it
exists today, I am unaware of any good solutions.

[snip description of nasty problem...]

> Perhaps you could give some ideas on approaches that would be more
> "Pythonic"?

Well, like I was trying to convey in my original message, I think
you're stuck.  Tim Peters actually came up with something a little
better, but I still think it's sad you have to write all kinds of
wrappers just to get a reasonable looping syntax.

FWIW, I completely agree that [x]range is awkward and inelegant (and
necessary) in these sorts of cases.  I'm also in full agreement with
better language support for more complex loops.  I haven't been really
happy with either of the PEPs, but I sure understand the problem
they're trying to address.






More information about the Python-list mailing list