Consider this code:
if (something1 is not None and
check_property(something_else) and
dr_jekyll is mr_hyde):
do_something(*args)
other_statements()
It is obviously hard to tell where the predicate ends and the statements of the body begin, despite the code being written in PEP-8 manner.
We have devised two variants:
if ((something1 is not None) and
(check_property(something_else)) and
(dr_jekyll is mr_hyde)):
do_something(*args)
other_statements()
which is ugly and
if (something1 is not None and
check_property(something_else) and
dr_jekyll is mr_hyde):
do_something(*args)
other_statements()
which is also ugly.
I personally prefer #1, and my colleague uses #2. Is there a non-ugly and PEP-8 compliant canonical solution which improves readability over the approaches listed above?