PEP 284, Integer for-loops

Steve Lamb grey at despair.dmiyu.org
Wed Mar 6 17:00:14 EST 2002


On Wed, 06 Mar 2002 08:41:31 -0800, David Eppstein <eppstein at ics.uci.edu>
wrote:
>     One of the most common uses of for-loops in Python is to iterate
>     over an interval of integers.  Python provides functions range()
>     and xrange() to generate lists and iterators for such intervals,
>     which work best for the most frequent case: half-open intervals
>     increasing from zero.  However, the range() syntax is more awkward
>     for open or closed intervals, and lacks symmetry when reversing
>     the order of iteration.  In addition, the call to an unfamiliar
>     function makes it difficult for newcomers to Python to understand
>     code that uses range() or xrange().
 
>     The perceived lack of a natural, intuitive integer iteration
>     syntax has led to heated debate on python-list, and spawned at
>     least four PEPs before this one.  

    Perceived lack.  IE, this is a solution looking for a problem.  I read it
and really have to ask.... why?  If people have a problem with it they just
need to flip open their Python book and take a few seconds to look it up.
Also the proposal takes a nice line-noise approach to it.  I want line noise,
I'll use Perl or Brainfuck.

-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
         ICQ: 5107343          | main connection to the switchboard of souls.
    To email: Don't despair!   |  -- Lenny Nero, Strange Days
-------------------------------+---------------------------------------------



More information about the Python-list mailing list