Status of PEP's?

Michael Chermside mcherm at destiny.com
Wed Mar 6 08:38:51 EST 2002


Not that my opinion means anything, but I'll go ahead and express it anyhow.

  1) I think that  "for i in range(len(items)):"  is awkward, annoying,
     and detracts from Python. There should be a better way.

  2) When I first saw PEP 276 I thought "Hey!, that's a nice solution!
     We're not using iteration for integers for anything else, and I
     certainly agree that looping from 0 to x-1 IS the "most obvious"
     thing to do (in Python anyhow), so it's really quite nice.

  3) Since then I've seen objections, typified by the following:

> I can NEVER bring myself to see an integer as a collection,
> not outside of a lecture on number theory, anyway.
> 
> Sorry to rant, but this is the only idea for Python I've seen in a
> VERY long time, since the 1.5.2 days, where rather than capturing
> my interest and giving me something to contemplate, just strikes me
> as ugly, and stays ugly no matter how long I look at it.

      I still think it's a nice solution, but with the vehemence of
      the objections, I have to back off.

  4) The need to use  "for i in range(len(items)):"  is STILL awkward,
     and STILL needs some solution. "for 0 <= i < len(items):" just
     doesn't do it for me.  "for x in [0:len(items)]:" is a pain.
     Perhaps something as simple as  "for i in iterlen(items):" is the
     answer (and throw in  "for i, x in iteritems(items):"  too) would
     do the trick. I don't know.

-- Michael Chermside

PS: *PLEASE* disregard the whole "set theory" argument. I don't think
   that anyone defending PEP 276 is suggesting it as the motivation...
   that makes it a classic "straw man" retorical fallacy. It's a red
   herring... the real motivation is simply that "loop from 0 to x-1" is
   the "most obvious" way to "iterate an integer" *IF* such a thing were
   allowed in Python.





More information about the Python-list mailing list