On Tue, Nov 27, 2018 at 9:15 AM Jonathan Fine <jfine2...@gmail.com> wrote: > Briefly, I don't like your suggestion because many important iterables > don't have a length!
That part's fine. The implication is that mapping over an iterable with a length would give a map with a known length, and mapping over something without a length wouldn't. But I think there are enough odd edge cases (for instance, is it okay to call the function twice if you __getitem__ twice, or should you cache it?) that it's probably best to keep the built-in map() simple and reliable. Don't forget, too, that map() can take more than one iterable, and some may not have lengths. (You can define enumerate in terms of map and itertools.count; what is the length of the resulting enumeration?) If you want a map-like object that takes specifically a single list, and is a mapped view to that list, then go for it - but that can be its own beast, not related to the map() built-in function. Also, it may be of value to check out more-itertools; you might find something there that you like. ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/