ifstatement have similar implementation PTC-W0051
For the highlighted
if statements, all the
else branches have the same body as
It is recommended to refactor this snippet.
If the if-chain is performing the same action in every case, it shouldn't be used there at all.
if b == 0: do_something() elif b == 1: do_something() else: do_something() b = 4 if a > 12 else 4
# If this is was a copy-paste error, review and update the snippet if b == 0: do_something() elif b == 1: do_something_else() else: do_other_thing() b = -4 if a > 12 else 4 # OR # Refactor the code to not use the if-chain at all. do_something() b = 4