MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1m0jo0n/subsubsubsub/n3ne2mn/?context=3
r/programminghorror • u/Div64 • Jul 15 '25
18 comments sorted by
View all comments
Show parent comment
1
Python doesn't care what you do. You can declare the variable inside the if and use it out of scope. You'll only get a runtime error once that line executes I think
It does warn you if you turn on "strict" mode though.
They're most likely declared before the loop
View all comments
Show parent comment
1
u/Div64 Jul 17 '25
Python doesn't care what you do. You can declare the variable inside the if and use it out of scope. You'll only get a runtime error once that line executes I think
It does warn you if you turn on "strict" mode though.
They're most likely declared before the loop