I can't find any PEP reference to the use of a blank line before return so would like to know what is the common practice.
Example A1:
def add(a,b):
""" docstrings"""
a = a + 2
b = b + 2
c = a +b
return c
Example A2:
def add(a,b):
""" docstrings"""
a = a + 2
b = b + 2
c = a +b
return c
Example B1:
def add(a,b):
""" docstrings"""
if a > b:
c = a + b
else:
c = a -b
return c
Example B2:
def add(a,b):
""" docstrings"""
if a > b:
c = a + b
else:
c = a -b
return c
Example C1:
def add(a):
""" docstrings"""
for i in range(3):
a = a + i
return a
Example C2:
def add(a):
""" docstrings"""
for i in range(3):
a = a + i
return a
Which ones are the common practice in these use cases (A, B, C)? Does anything change when a block of if-else or a loop is involved before the return statement?