Useless return at end of function or method
100
101 plt.show()
102
103 def changeInCasesOverTimeAndLocation():104 def open_file():
105
106 file = filedialog.askopenfile(filetypes=[("Python Files", "*.csv")])
Description
A single return
or return None
statement is found at the end of the function or method definition. This statement can safely be removed to improve the readability because Python will implicitly return None
.
Bad practice
def log_data(data):
'''Sends the data to our logging API.'''
api = get_api()
api.send(data)
return # Unnecessary return
def print_pattern():
print('*')
print('**')
print('***')
return None # Unnecessary return
Recommended
def log_data(data):
'''Sends the data to our logging API.'''
api = get_api()
api.send(data)
def print_pattern():
print('*')
print('**')
print('***')