Great answers, but just wanted to mention a gotcha that "pass" keyword will not work in the if/else part of the list-comprehension (as posted in the examples mentioned above).
#works
list1 = [10, 20, 30, 40, 50]
newlist2 = [x if x > 30 else x**2 for x in list1 ]
print(newlist2, type(newlist2))
#but this WONT work
list1 = [10, 20, 30, 40, 50]
newlist2 = [x if x > 30 else pass for x in list1 ]
print(newlist2, type(newlist2))
This is tried and tested on python 3.4. Error is as below:
newlist2 = [x if x > 30 else pass for x in list1 ]
SyntaxError: invalid syntax
So, try to avoid pass-es in list comprehensions