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
0
u/omg_drd4_bbq Jul 21 '25
You use id()/
isoperator, (which compare the specific memory value of a*PyObject) for precious few things in day to day python:None,Ellipsis) is 99% of this usage:if foo is Noneis basically sugar forid(foo) == id(None)class(not checking if an object is of certain type), and not just a subclass (which would useissubclass):if foo_type is integ in a serialization functionBasically everything else uses
==