I want to create an array inline like this:
[x if arr[arr.index(x)+1] < x for x in arr]
but when i do it python tells me i cant do that without having an else branch to my if statement.
The only "solution" I found was this: list(filter(lambda x: x != None, [x if arr[arr.index(x)+1] < x else None for x in arr])
but that is just ugly, and unnessecary. The reason i want to initialize the array this way is to keep the code short and clean, but now it would just be better to do a normal for loop.
Hopefully there are better ways to do this ;)