I love Python but my personal hate goes for this when used in list comprehensions.
a = [1,2,3]
# list comprehension with if
[ x for x in a if x > 1]
[2, 3]
# list comprehension with if/else
[ x if x > 1 else x*2 for x in a]
[2, 2, 3]
When it's just "if" it goes after the "for", when it's "if/else" it goes, all of it, before. I still don't understand why it's this way, it doesn't even make sense even reading it in natural language. I much prefer the mathematical-like syntax present in Scala for this.
Edit: Thanks for the responses, they are are insightful, never thought of this that way.
Still in my head the lack of "else" clause implies filtering no matter where, while its presence implies transformation no matter where. The first element of the list is always transformed (though in this example it's identity).
I think it's a case of Python trying to do too much with too little. Personally for anything relatively complicated I still prefer to use filter() and map() as list comprehensions can get unwieldly quick.