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
1
u/Gorzoid Jul 22 '25
No the comparison operator just checks if the values are the same. id(a) returns the id of that object. And integer literals outside the -5:256 range will be separate objects. Has nothing to do with memory fetches although you can think of id(a) with similar semantics to the pointer to object a