[Python-Dev] Propose to reject PEP 276 -- Simple iterator for ints
Guido van Rossum
gvanrossum at gmail.com
Fri Jun 17 08:09:54 CEST 2005
I've never liked that idea. Down with it!
On 6/16/05, Raymond Hettinger <raymond.hettinger at verizon.net> wrote:
> The principal use case was largely met by enumerate(). From PEP 276's
> rationale section:
>
> """
> A common programming idiom is to take a collection of objects and apply
> some operation to each item in the collection in some established
> sequential order. Python provides the "for in" looping control
> structure for handling this common idiom. Cases arise, however, where
> it is necessary (or more convenient) to access each item in an "indexed"
> collection by iterating through each index and accessing each item in
> the collection using the corresponding index.
> """
>
> Also, while some nice examples are provided, the proposed syntax allows
> and encourages some horrid examples as well:
>
> >>> for i in 3: print i
> 0
> 1
> 2
>
> The backwards compatability section lists another problematic
> consequence; the following would stop being a syntax error and would
> become valid:
>
> x, = 1
>
> The proposal adds iterability to all integers but silently does nothing
> for negative values.
>
> A minor additional concern is that floats are not given an equivalent
> capability (for obvious reasons) but this breaks symmetry with
> range/xrange which still accept float args.
>
>
> Raymond
>
>
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list