[Python-Dev] PEP 0424: A method for exposing a length hint

Mark Dickinson dickinsm at gmail.com
Tue Jul 17 09:49:26 CEST 2012

On Sun, Jul 15, 2012 at 1:36 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Sun, 15 Jul 2012 18:47:38 +1000
> Nick Coghlan <ncoghlan at gmail.com> wrote:
>> I'm not seeing the value in returning None over 0 for the don't know
>> case - it just makes the API harder to use.
> The point is that 0 is a legitimate value for a length hint. Simple
> implementations of __length_hint__ will start returning 0 as a
> legitimate value and you will wrongly interpret that as "don't know",
> which kinds of defeat the purpose of __length-hint__ ;)

I agree with this: giving special meaning to what's already a valid
length value seems wrong.


More information about the Python-Dev mailing list