# example.py
[very_long_item_name for very_long_item_name in function(something) if condition]
Result
[very_long_item_name for very_long_item_name in function(
something) if condition]
This is hard to read. Even if function has more arguments, this looks confusing to me. I would have expected any of the following (depending on the length of function(something) and condition):
# Better solution?
[very_long_item_name for very_long_item_name
in function(something) if condition]
# ... or?
[very_long_item_name for very_long_item_name in
function(something) if condition]
# For long `function(something)` or `condition`?
[very_long_item_name
for very_long_item_name
in function(something)
if condition]
# ...or?
[very_long_item_name for
very_long_item_name in
function(something) if
condition]
(I prefer the first and third solution.) Or is this a situation where the "correct" solution is to rewrite the comprehension using loops?
Python Code
Result
This is hard to read. Even if
function
has more arguments, this looks confusing to me. I would have expected any of the following (depending on the length offunction(something)
andcondition
):(I prefer the first and third solution.) Or is this a situation where the "correct" solution is to rewrite the comprehension using loops?
Command Line and Configuration
No configuration.
Command Line
Your Environment