[Python-Dev] More imformative iterator representations
Robert Brewer
fumanchu at amor.org
Wed Apr 7 01:27:55 EDT 2004
Bob Ippolito wrote:
> > Raymond Hettinger wrote:
> >> Q: Are there any other candidate output formats?
> >> A: Yes, we could add length information for a more
> mathematical style
> >> output:
> >>
> >> reversed(['h', 'g', 'f', ... to 8 objects])
> >
> > The very presence of __len__ might be a strong argument for
> providing
> > the new repr, and its absence an indicator to avoid such.
>
> This is essentially getting back to what Armin was saying.. if
> iterators act more like lists, they will be easier to user and will
> open up some new doors for optimization potential. Adding a
> way to get
> the length of some iterators essentially makes them list-like or
> tuple-like.
Agreed. I don't mind the crux of Armin's idea, I was reacting more to
applying such optimizations to enumerate() in particular. Given
sufficient clarification like the above, it'd be easier to swallow.
Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org
More information about the Python-Dev
mailing list