On Tue, 17 Jul 2012 00:18:55 +1000
Nick Coghlan
Given that all standard library containers default to assuming a size of zero (absent information indicating otherwise), and a special value would need to be special cased by *every* client of the API (and almost always defaulted to zero), it's simply not a good trade-off.
Actually, dict and set default to a non-zero internal size, but I agree making containers harder to implement is not a good thing.
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.
Noting that infinite iterators are free to define __length_hint__ to always throw an exception *is* the status quo.
Being "free" to do unexpected or unconventional things is not the same thing as codifying those behaviours in a PEP, especially when noone is actually doing them. __length_hint__ is supposed to be informative, it shouldn't error out on you. So still -1 from me. Regards Antoine.