List comprehensions can be useful in certain situations, but they can also be rather horrible to read.. As a slightly exaggerated example, how would you indent the following?
allUuids = [x.id for x in self.db.query(schema.allPostsUuid).execute(timeout = 20) if x.type == 'post' and x.deleted is not False]
It depends on how long they are. I tend to structure them like so:
That way every expression has its own line.
If any line becomes too big I like to extract it out in a lambda or expression:
And then if a lambda becomes too long it gets promoted to a function.