unlawfulbooger@lemmy.blahaj.zone to Programmer Humor@lemmy.ml · 2 years agoOn this deserted island I could use some help()lemmy.blahaj.zoneimagemessage-square32linkfedilinkarrow-up11.18Karrow-down113 cross-posted to: programmer_humor@programming.dev
arrow-up11.17Karrow-down1imageOn this deserted island I could use some help()lemmy.blahaj.zoneunlawfulbooger@lemmy.blahaj.zone to Programmer Humor@lemmy.ml · 2 years agomessage-square32linkfedilink cross-posted to: programmer_humor@programming.dev
minus-squareZron@lemmy.worldlinkfedilinkarrow-up20arrow-down2·2 years 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-squareBronco1676@lemmy.mllinkfedilinkarrow-up17·2 years 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 >>>
minus-squareEmergMemeHologram@startrek.websitelinkfedilinkarrow-up17·2 years agoReminds me of setting pi = 3 in my friends matlab subroutines in school.
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.
Reminds me of setting pi = 3 in my friends matlab subroutines in school.
wow it does do that. cool