How Python Computes the Boolean Value of Objects
Default Truthiness for Instances Without Special Methods Objects that implement neither __bool__ nor __len__ always evaluate as True in Boolean contexts. class Packet: pass pkt = Packet() print(bool(pkt)) # True Controlling Evaluasion with __bool__ If a class defines __bool__, that method's return v...