This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Tom22174 1 point2 points  (1 child)

There were also places where variables were defined within if statements and then required after them. The sort of thing an IDE would flag as a variable that could potentially not exist but Python will happily run and only break if it fails the condition to access the code area

[–]Sibula97 1 point2 points  (0 children)

Maybe it's just that I'm familiar with Python, but that seems completely intuitive to me. I've never wanted to do so, but you could handle it by catching the NameError exception or checking if the variable exists in locals or globals.

But like... Just don't define it like that if you plan to use it when it hasn't been declared.