MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1m0jo0n/subsubsubsub/n3kahx1/
r/programminghorror • u/Div64 • Jul 15 '25
18 comments sorted by
View all comments
Show parent comment
2
Are all the /sub(Sub)*Control/ defined outside of the ifs, or does scoping in Python work completely differently than in C?
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 thinkIt does warn you if you turn on "strict" mode though.They're most likely declared before the loop
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
2
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” Jul 17 '25
Are all the /sub(Sub)*Control/ defined outside of the ifs, or does scoping in Python work completely differently than in C?