Is the following considered bad practice:
var = var if 'var' in globals() else None
In other words, if there is an if statement that defines a variable, and I may need to access that variable later, to use a construction such as the above, instead of having to define the variable as None before the if statement.
Why or why not would the above construction be acceptable?
An example would be like this:
if process == 'yes':
# 100 lines of code
obj = {...}
return Response(obj)