Range Operation pre-PEP

Walter Moreira walterm at cmat.edu.uy
Wed May 9 15:10:39 EDT 2001

On Wed, May 09, 2001 at 09:52:46AM -0600, Bjorn Pettersen wrote:
> If all we want to do is get rid of 
>   for i in range(len(seq)):
> 	...
> why not overload range so it can take a sequence directly:
>   for i in range(seq):
>       ...

Isn't more pythonic the recipe (i think it is from Alex):

   for i, a in Indexed(seq):

where indexed is just:

   class Indexed:
       def __init__(self, seq):
           self.seq = seq
       def __getitem__(self, i):
           return i, self.seq[i]

? Do we really need syntatic changes (..) and semantic changes also? Doesn't
things like '..' make the language more difficult to learn for begginners? 

The reference manual must be bigger and bigger with each addition of this
kind. Other changes, like the elimination of the type/class differences make
the manual smaller. I think these are the things to be focused on.


Walter Moreira  <> Centro de Matematica  <> Universidad de la Republica
email: walterm at cmat.edu.uy <> HomePage: http://www.cmat.edu.uy/~walterm
        /OD\_    |   Contrary to popular belief, Unix is user friendly.
 O o . |_o_o_)   |   It just happens to be very selective about who its
                 |   friends are.                         -- Kyle Hearn

More information about the Python-list mailing list