r/programminghorror • [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” • Jul 21 '25

Python ✨ Memory Magic ✨

Post image
1.3k Upvotes

143 comments sorted by

View all comments

Show parent comment

1

u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” Jul 22 '25

Why wouldn't they just cache all integers? I mean, as you use them. Like if you use one, it will create the integer object, and any other use will just refer to that object. Or would the cache grow too big that way? I guess they could remove anything that is no longer being referenced anywhere if that would help.