Is it possible to declare a variable in Python, like so?:
var
so that it initialized to None? It seems like Python allows this, but as soon as you access it, it crashes. Is this possible? If not, why?
EDIT: I want to do this for cases like this:
value
for index in sequence:
if value == None and conditionMet:
value = index
break
Duplicate
- Uninitialised value in python (by same author)
- Are there any declaration keywords in Python? (by the same author)
Related
- Python: variable scope and function calls
- Other languages have “variables”