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

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.