[Python-Dev] _length_cue()

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Feb 9 04:27:54 CET 2006

Armin Rigo wrote:

> This said, do we vote for __length_hint__ or __length_cue__? :-)

I prefer something containing "hint" rather than "cue"
because it more explicitly says what we mean.

I feel that __length_hint__ is a bit long, though.
We have __len__, not __length__, so maybe it should
be __len_hint__ or __lenhint__.

> And does anyone objects about __getitem_hint__ or __getitem_cue__?

I'm having trouble seeing widespread use cases for this.
If an object is capable of computing arbitrary items on
demand, seems to me it should be implemented as a
lazily-evaluated sequence or mapping rather than an

The iterator protocol is currently very simple and
well-focused on a single task -- producing things
one at a time, in sequence. Let's not clutter it up
with too much more cruft.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | Carpe post meridiam!          	  |
Christchurch, New Zealand	   | (I'm not a morning person.)          |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+

More information about the Python-Dev mailing list