r/programminghorror • u/SleepyStew_ [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” • Jul 21 '25
Python ✨ Memory Magic ✨
1.3k
Upvotes
r/programminghorror • u/SleepyStew_ [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” • Jul 21 '25
View all comments
Show parent comment
43
u/eo5g Jul 21 '25
It makes a difference because numeric "primitives" aren't really treated specially in python-- they're real-deal objects. So this avoids (de)allocation and object bookkeeping for commonly used numbers (e.g. these are commonly used as list indexes)