@[email protected] to Programmer [email protected] • 11 months agoOn this deserted island I could use some help()lemmy.blahaj.zoneimagemessage-square29fedilinkarrow-up11.15Karrow-down113
arrow-up11.14Karrow-down1imageOn this deserted island I could use some help()lemmy.blahaj.zone@[email protected] to Programmer [email protected] • 11 months agomessage-square29fedilink
minus-square@Zronlink18•11 months agoBecause exit might be a variable you use to determine if you should exit. exit() is a function that actually does the exiting. It’s the difference between pointing at a jogger and saying “run” and actually running after them.
minus-square@[email protected]linkfedilink17•11 months agoIf you have a variable called exit you’ve overwritten the function in that scope, and won’t be able to execute it. e.g. >>> exit=1 >>> exit() Traceback (most recent call last): File "", line 1, in TypeError: 'int' object is not callable >>>
Because exit might be a variable you use to determine if you should exit. exit() is a function that actually does the exiting.
It’s the difference between pointing at a jogger and saying “run” and actually running after them.
If you have a variable called
exit
you’ve overwritten the function in that scope, and won’t be able to execute it.e.g.
>>> exit=1 >>> exit() Traceback (most recent call last): File "", line 1, in TypeError: 'int' object is not callable >>>
deleted by creator
wow it does do that. cool