formatting - How should I indent ternary conditional operator in python so that it complies with PEP8? -
pep8 doesn't ternary operators, if not mistaken. suggest, how should write long lines ternary conditional operators?
some_variable = some_very_long_value \ if very_long_condition_holds \ else very_long_condition_doesnt_hold or
some_variable = some_very_long_value \ if very_long_condition_holds \ else very_long_condition_doesnt_hold which 1 prefer most?
neither. long line, it's improve utilize parentheses allow line breaks. opinions differ whether should this:
some_variable = (some_very_long_value if very_long_condition_holds else very_long_condition_doesnt_hold) or this:
some_variable = ( some_very_long_value if very_long_condition_holds else very_long_condition_doesnt_hold) or this:
some_variable = ( some_very_long_value if very_long_condition_holds else very_long_condition_doesnt_hold ) personally prefer third; google in-house style second.
python formatting pep8 ternary
No comments:
Post a Comment