Recap: PEP 276 Simple Iterator for ints

Dr. David Mertz mertz at
Fri Nov 16 10:03:19 CET 2001

Hi James,

Thanks for the very nice summary of the discussion on the PEP276 threads
(including some bits that I chimed in on, like the Haskell examples).  I
have actually not particularly -argued- for any particular new syntax.
I suppose partly because I am too lazy to write a PEP; I've mostly
wanted people in the discussion to think about options... and about what
new users will find obvious.

In terms of your PEP itself, you've probably already seen me mention
that I slightly dislike it.  I won't cry if it makes it in, and I will
probably even use it.  But I can see stumbling over the construct in
someone elses code.  Your example:

|    for i in table.getRowCount():
|        for j in table.getColumnCount():
|            print table.getValueAt(i,j)

looks pretty clear.  The names make it fairly obvious what is intended.
But if PEP276 becomes an actual language feature, I think one is going
to occassionally see things like:

    for personRecord in 7:

*That* version will probably throw me for a loop.  And it will puzzle
newbies even more.  I readily admit that the names are not well chosen,
and the integer literal is awkward--that's why I chose them :-)--but
that's the sort of thing that happens.

My affection for the Haskell-style syntax is mostly because it is more
explicit (I don't care about how many dots and commas go in it).  But
also because it is more general (arbitrary stepping, obious application
to floats).  If one is going to do "this sort of thing" eventually, it's
better to do it all the way at first.  That way you avoid too many
slightly different ways of writing the same thing.

Yours, David...

---[ to our friends at TLAs (spread the word) ]--------------------------
Echelon North Korea Nazi cracking spy smuggle Columbia fissionable Stego
White Water strategic Clinton Delta Force militia TEMPEST Libya Mossad
---[ Postmodern Enterprises <mertz at> ]--------------------------

More information about the Python-list mailing list