[swift-evolution] Proposal: Python's list, generator, and dictionary comprehensions
Paul Ossenbruggen
possen at gmail.com
Thu Dec 17 11:54:47 CST 2015
I like this in python. +1
> On Dec 17, 2015, at 8:26 AM, Amir Michail via swift-evolution <swift-evolution at swift.org> wrote:
>
> Python examples:
>
> l = [x*x for x in range(10)] // list comprehension
>
> l2 = [(x,y) for x in range(10) for y in range(10) if x + y < 8] // another list comprehension
>
> g = (x*x for x in range(10)) // generator comprehension
>
> d = {x:x*x for x in range(10)} // dictionary comprehension
>
>
> I think most programmers would like using these. They are concise and easy to understand.
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
More information about the swift-evolution
mailing list