Status of PEP's?

Carel Fellinger cfelling at iae.nl
Wed Feb 27 22:16:35 EST 2002


James_Althoff at i2.com wrote:

> Below is a revision (not yet submitted) of PEP 276.

> Rather than restart the entire debate on PEP 276, please send me
> suggestions for specific changes to the PEP.

I'm sorry not to obey, but I find this PEP so hard to appreciate and
you being such a heavy weight that I fear Guido might be lured into
thinking this to be a good idea that I felt compelled to react in
public.

I admit up front that this is indeed a very minimalistic solution.
But I fail to understand how you can propose to range over a number.
Maybe it's my flaky understanding of the deeper levels of math, but
to me a number is a singular thing, not like a sequence at all.
So please explain why you think it natural to loop over a number.


...
>     - Unwieldy, especially when combined with the len() function,
>       i.e., xrange(len(sequence))

I miss in your discussion mentioning of the proposal to enhance (x)range
to accept a sequence as parameter and generate the indici for it.

...
>     Finding a new syntax that is comprehensive, simple, general,
>     Pythonic, appealing to many, easy to implement, not in conflict
>     with existing structures, not excessively overloading of existing
>     structures, etc. has proven to be more difficult than one might
>     anticipate.

And I don't see convincing arguments against having to use a function
call to get the indici sequence derived from a single number like in:

     for rowcount in range(table.getRowCount()):

Your proposed:

>      for rowcount in table.getRowCount():

really makes me wonder, what the heck is going on here.  I would
expect table.getRowCount() to return an integer, but instead it
returns a sequence, better look up what the code does.  Wonder,
wonder, it *does* return an integer. Wonder, wonder.  Oh wait, someone
better versed in math seemed it natural to view an integer as the
sequence of integers that precede it.

Sorry that the above sounds pissed, think I am, know I shouldn't:(

>From the discussions at the time, I understood there were more
that really didn't understand how you could loop over a single
number, and here in your PEP you make it look like some minority
of nitwits objected, that it was merely a matter of preference.
I obviously don't agree with that.  It's not a matter of preference,
it's lack of understanding what it means to loop over a single number.

So please add a section in your PEP explaining why it is natural
to loop over a number.  Trow in some math theory or whatever,
educate us, but don't treat it as a matter of taste.

You see, I would understand things like
    for room in house:
or
    for tree in forest:
but I fail to understand things like
    for atom in atom:


>     - Some feel that iterating over the sequence "0, 1, 2, ..., n-1"
>       for an integer n is not intuitive.  "for i in 5:" is considered
>       (by some) to be "non-obvious", for example.

>       Response: This seems to be largely a matter of preference.
>       Some like the proposed idiom and see it as simple and
>       elegant.  Some are neutral on this issue.  Others, as noted,
>       dislike it.


>     The majority of disagreement with PEP 276 came from those who
>     favor much larger changes to Python to address the more general

At the time I really thought it was your april 1st joke.  And I wouldn't
be surprised when others thought the same.  How sad we didn't react
there at that moment, so the counts would be more balanced:)

-- 
groetjes, carel



More information about the Python-list mailing list