Useless return at end of function or method
99
100 plt.show()
101
102 def changeInCasesOverTimeAndLocation():103 def open_file():
104
105 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('***')