Guido van Rossum
guido at python.org
Wed Feb 8 18:59:07 CET 2006
+1 for __length_hint__. Raymond?
On 2/8/06, Andrew Koenig <ark at acm.org> wrote:
> > I'm worried about the name. There are now exactly two names that behave
> > like a special method without having the double-underscores around it.
> > The first name is 'next', which is kind of fine because it's for
> > iterator classes only and it's documented. But now, consider: the
> > CPython implementation can unexpectedly invoke a method on a
> > user-defined iterator class, even though this method's name is not
> > '__*__' and not documented as special! That's new and that's bad.
> Might I suggest that at least you consider using "hint" instead of "cue"?
> I'm pretty sure that "hint" has been in use for some time, and always to
> mean a value that can't be assumed to be correct but that improves
> performance if it is.
> For example, algorithms that insert values in balanced trees sometimes take
> hint arguments that suggest where the algorithm should start searching for
> the insertion point.
> Python-Dev mailing list
> Python-Dev at python.org
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev