[swift-evolution] Proposal: Python's list, generator, and dictionary comprehensions
Amir Michail
a.michail at me.com
Thu Dec 17 10:26:27 CST 2015
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.
More information about the swift-evolution
mailing list