Is it possible only to declare a variable without assigning any value in Python?

后端 未结 14 1850
暖寄归人
暖寄归人 2020-11-30 17:26

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

14条回答
  •  北海茫月
    2020-11-30 17:51

    It is a good question and unfortunately bad answers as var = None is already assigning a value, and if your script runs multiple times it is overwritten with None every time.

    It is not the same as defining without assignment. I am still trying to figure out how to bypass this issue.

提交回复
热议问题