I have been just wondering if it is possible to somehow combine 'if' and 'as' statements like this:
if possible_error() as error:
return error
instead of
error = possible_error()
if error:
return error
where 'possible_error' function returns either empty string or error message. By doing so I could save one line of code.
I know that some compromise is to run this function twice:
if possible_error():
return possible_error()
but I would rather avoid doing this.