Python and the need for speed

Ian Kelly ian.g.kelly at gmail.com
Wed Apr 12 02:55:18 EDT 2017


On Tue, Apr 11, 2017 at 8:08 PM, Steve D'Aprano
<steve+python at pearwood.info> wrote:
> Comprehensions may have been around for a decade or two in Haskell, but most
> older languages don't have them. I'm pretty sure Java doesn't.

Java does not have comprehensions per se, but the Streams API
introduced in Java 8 is similar in concept and also much more powerful
-- for example, streams can be executed either serially or in
parallel, which is not a feature of any list comprehension I've ever
seen.

https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html

> Does
> Javascript? Comprehensions feel like a fancy new language feature to me.

ES6 was going to include array comprehensions and generator
comprehensions but these didn't make it into the final version. My
understanding is that they were deferred because the committee hoped
to come up with something more LINQ-like, which I think is also
greatly motivated by parallelism concerns.



More information about the Python-list mailing list