Cross-language comparison: function map and similar

Pavol Lisy pavol.lisy at gmail.com
Thu Aug 17 01:54:23 EDT 2017


On 8/16/17, Steve D'Aprano <steve+python at pearwood.info> wrote:
> Over in another thread, we've been talking about comprehensions and their
> similarities and differences from the functional map() operation.
>
> Reminder:
>
> map(chr, [65, 66, 67, 68])
>
> will return ['A', 'B', 'C'].
>
> My questions for those who know languages apart from Python:
>
> Are there language implementations which evaluate the result of map() (or
> its
> equivalent) in some order other than the obvious left-to-right first-to-last
> sequential order? Is that order guaranteed by the language, or is it an
> implementation detail?

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



More information about the Python-list mailing list