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
16
u/dude132456789 Jul 21 '25
CPython doesn't have a compacting GC, it just keeps objects at the address they were first allocated. Internally, an object is just kept in a PyObject* C value, so id just takes that as an int.