Status of PEP's?

Jeff Hinrichs jlh at cox.net
Mon Mar 4 18:50:51 EST 2002


<James_Althoff at i2.com> wrote in message
news:mailman.1015277468.2249.python-list at python.org...
>
> [Jeff Hinrichs]
> > How can one iterate over something that is not a
> > sequence/collection?
>
> By defining the method __iter__(self) to return an iterator object <wink>.
> Iterators are very useful and general-purpose.  No need to confine them
> just to sequences.
>
>
> > I haven't seen any argument on why range/xrange is less preferrable to
> iterable integers.
>
> The advantage that iter(n) has over range(n) and xrange(n) is that Python
> calls iter automatically.
>
>
> > I've heard the philosophical debate but not seen how python
> > would be better for this addition.  If a good, tangible case
> > were made I could be influenced.
> > It would have to be a stronger case than:
> > for i in 5:  is better than   for i in range(5):
> >     print i                       print i
>
> Please refer to the PEP.  There is a "rationale" section.  "for i in 5"
> happens to work and I would wager would become popular when typing into
the
> intepreter, for example.  But, it is not the motivating example in the
PEP.
>
>
> > **Not everything is an object.**
>
> Fortunately, in Python it is <wink>.
>
>
> > Numbers don't perform operations
>
> ... and they can <wink>
>
> >>> -3 .__abs__()
> -3
> >>>
>
>
> > It is not natural to consider a number as a collection of other
> > numbers.
>
> So don't consider that.  Just consider whether or not it would be useful
to
> get an iterator from a number <wink>.
Ok, so after 3 days of exposing myself as an object luddite, I think I
understand what is being asked for and why the proponents are so strongly in
favor of it.   I have officially upgraded my position to neutral on the
matter. (at this rate, I might be in the pro camp by Thursday <wink>) I
would like to thank everyone one (carel and james) for taking the time to
enlighten me (even if sometimes it requires a 2x4')

glad-I'm-not-an-iterable-object-ly'yrs,
-Jeff





More information about the Python-list mailing list