Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I prefer:

    [int(x) for x in "10 20 30".split(' ')]


Why? It's longer and requires an extra check to make sure that it's the same variable mentioned twice (i.e., you read to read it carefully to distinguish from [int(x) for y in "10 20 30".split(' ')]). Is it just that since comprehensions are more commonly used you think some people might forget what map does nad have to look it up?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: