Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
aaronchall
on July 25, 2015
|
parent
|
context
|
favorite
| on:
Functional Programming in Python [pdf]
Yes, in Python 2.7 onward:
s = {i**2 for i in range(10) if i}
and the colon is what makes the dict comprehension different from the set comprehension:
d - {i:i**2 for i in range(10) if i}
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: