17 Jul
2012
17 Jul
'12
3:49 a.m.
On Sun, Jul 15, 2012 at 1:36 PM, Antoine Pitrou
On Sun, 15 Jul 2012 18:47:38 +1000 Nick Coghlan
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. Mark