Rule Definition
Clever use of optional parentheses in expressions involving few operators or long lines can dramatically enhance the readability of the code. On the contrary, when a superfluous parenthesis is unintentionally introduced (perhaps influenced by other language syntaxes) it contributes to visual clutter.
Remediation
Remove the superfluous parenthesis or leverage it to construct multiline expressions.
Violation Code Sample
# example 1
if (value == 1):
return value
# example 2
while (condition1 and condition2 and condition3):
do_something()
Fixed Code Sample
# example 1
if value == 1:
return value
# example 2
while (condition1 and
condition2 and
condition3):
do_something()
Reference
PEP-8
Related Technologies
Technical Criterion
Documentation - Style Conformity
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.