PEP 284, Integer for-loops

Delaney, Timothy tdelaney at avaya.com
Wed Mar 6 22:58:48 EST 2002


> From: Greg Ewing [mailto:greg at cosc.canterbury.ac.nz]
>
> > Or is it the intention that the construct is *not* limited 
> strictly to the
> > Python builtin classes "int" and "long"?  Will it work for 
> any class that
> > defines __lt__, __lg__, __gt__, __ge__, __add__, and 
> __radd__ methods, for
> > example?
> 
> So, floats will have to be treated as a special case,
> and if we're having special cases, it would be better to
> have *only* special cases -- i.e. restrict it to types
> that we'res sure we know enough about to do the right
> thing with. That means ints, longints and floats.

In that case, I must strongly oppose this PEP. Adding new *syntax* to
enhance only a few types in a way which looks nice, but has severe
limitations, is IMO the wrong thing to do.

As far as I can see, the only advantages to this PEP now are that it looks
nicer than range(), and it is easier to construct in some cases.

Tim Delaney




More information about the Python-list mailing list