On Thu, 17 Aug 2017 03:54 pm, Pavol Lisy wrote: > Is it guaranteed in python? Or future version could implement map with > something like subscriptability "propagation"? > >>>>range(1_000_000_000_000_000_000)[-1] > 9999999999999999 > >>>> map(lambda a:a+1,range(1_000_000_000_000_000_000))[-1] > TypeError: 'map' object is not subscriptable
I don't recognise the term "subscriptability propagation". Given a suitable deprecation period, or another backwards-incompatible release like Python 3, anything is possible. But some things are very unlikely, such as another backwards-incompatible release, or map supporting indexing. Python's map() now returns an iterator, which means it must yield items one by one, in order. Because it is an iterator, in general it cannot know what the next item will be until it evaluates it. Unlike range, it cannot jump ahead In principle we could have map() return a magic iterator that delegated indexing to the underlying sequence, but that's not part of the iterator API and the benefit seems small. So, possible but unlikely. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list