PEP 284, Integer for-loops

Bjorn Pettersen BPettersen at NAREX.com
Wed Mar 6 13:37:17 EST 2002


> From: David Eppstein [mailto:eppstein at ics.uci.edu] 
> Subject: PEP 284, Integer for-loops

Thanks for writing the PEP.

I see this as a general proposal for a range syntax, and I disagree with
it because:

  - it doesn't handle the general range issues, i.e. step value,
    and if we had to add yet another syntax to get general ranges
    it would be too confusing.

  - I would like range objects to be first class, ie. I would want
    to be able to pass ranges to functions, return them from 
    functions, and do all the other things one can do with first
    class objects. This proposal only adds syntactic sugar to the 
    for loop.

  - It doesn't make the general case trivial, i.e. 
    for 0 <= i < len(mySequence) is not much better than 
    for i in range(len(mySequence) and is more verbose than
    for i in len(mySequence).

-- bjorn




More information about the Python-list mailing list