2 ms·
Defaulting to False is the next best thing. Evil starts when objects of different types are considered value-equal under some circumstances. Python does not ha
by nine_k 4y ago
Defaulting to False is the next best thing.
Evil starts when objects of different types are considered value-equal under some circumstances. Python does not have this, with the benign exception of promoting ints to floats, so that 1 == 1.0.
- int_19h 4y agoIt doesn't quite default to False, since every object is still equal to itself. The consequence is that people use == for identity equality sometimes - often not fully intentionally, e.g. by using objects as dict keys directly without using id(). But, conversely, a design that doesn't allow == for everything means that value-equality and reference-equality dicts would have to be different, as well.