[Python-Dev] PEP 0424: A method for exposing a length hint (original) (raw)

Lennart Regebro regebro at gmail.com
Tue Jul 17 16:02:05 CEST 2012


On Sun, Jul 15, 2012 at 1:28 AM, Alexandre Zani <alexandre.zani at gmail.com> wrote:

I'm +1 on not having a public API for this. Ultimately the contract for a length hint will depend heavily upon what you need it for. Some applications would require a length hint to be an "at least" others an "at most" and others something else entirely. Given that the contract here appears to be >=0, I don't think the length hint is particularly useful to the public at large.

Other possible related uses could be to get an approximate number of results for a query without having to actually go through the whole query, useful for databases and search engines. But then you do want len as well, so that also doesn't fit with the current PEP.

But maybe that's a completely different usecase, even though it seems related to me?

//Lennart



More information about the Python-Dev mailing list