
On Mon, 16 Jul 2012 23:23:18 +1000 Nick Coghlan <ncoghlan@gmail.com> wrote:
- distinguishing between different reasons for saying "don't preallocate any space" (i.e. returning zero). I still haven't heard a convincing rationale for this one
The point is that zero is a valid value for a length hint. By making it a special value for "don't know", you are making the protocol potentially confusing, and you are also departing from the current semantics. (and, yes, I think distinguishing between zero and "don't know" is useful: imagine a container that would preallocate 256 entries by default when the answer is "don't know")
The PEP itself already has this general tone, but I think that it should be even more emphatic that it's about codifying the status quo, *not* about modifying it with ideas haven't been proven useful through past experience.
Then the PEP shouldn't address infinite iterators at all. Regards Antoine. -- Software development and contracting: http://pro.pitrou.net