On Sun, Dec 2, 2018 at 11:52 PM Greg Ewing <greg.ew...@canterbury.ac.nz> wrote: > > Steven D'Aprano wrote: > > Perhaps more like the principle of most > > astonishment: the object changes from sized to unsized even if you don't > > modify its value or its type, but merely if you look at it the wrong > > way: > > Yes, but keep in mind the purpose of the whole thing is to > provide a sequence interface while not breaking old code > that expects an iterator interface. Code that was written > to work with the existing map() will not be calling len() > on it at all, because that would never have worked. > > > Neither fish nor fowl with a confusing API that is not > > quite a sequence, not quite an iterator, not quite sized, but just > > enough of each to lead people into error. > > Yes, it's a compromise in the interests of backwards > compatibility. But there are no surprises as long as you > stick to one interface or the other. Weird things happen > if you mix them up, but sane code won't be doing that.
Indeed; I believe it is very useful to have a map-like object that is effectively an augmented list/sequence. _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/