[Python-Dev] _length_cue()

Andrew Koenig ark at acm.org
Wed Feb 8 17:54:14 CET 2006


> 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.





More information about the Python-Dev mailing list