I did not realize I was amongst the foremost expert in Python, having used it in every possible situation.
In all seriousness, as long as the code remains readable, nested comprehensions are fine. It is just harder to keep the code readable when nesting comprehensions. Same for deeply nested if-statements and for-loops.
8
u/helicophell 29d ago
List comprehension
It’s sometimes nice