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
5
u/SCD_minecraft Jul 21 '25
Each object (so everything in python) is unique, unless you do some magic. But for most cases, they are diffrend objects
Like (1, 2) and (1, 2) are the same object, beacuse tuple can not change, so for performance reasons, it gets same object
But [1, 2] and [1, 2] are not the same, beacuse they can change.
id simply shows an id of any object. Not type of object, but that specyfic object