We have a function that processes the user request if it is not None, how best to style it? I did not find a better choice in PEP8
Style 1
def user_handler(user):
if db.getUser(user) is not None:
"""
Here we have a big body of function
"""
return {'message': 'Successful handled'}
else:
return {'message': 'User not found'}
Style 2
def user_handler(user):
if db.getUser(user) is None:
return {'message': 'User not found'}
"""
Here we have a big body of function
"""
return {'message': 'Successful handled'}
UPD 1: Since there were a lot of questions in the comments regarding the content of the code, I remade the question into a more real one.