Skip to content Skip to sidebar Skip to footer
Showing posts with the label Equality

When Is The `==` Operator Not Equivalent To The `is` Operator? (python)

I noticed I can use the == operator to compare all the native data types (integers, strings, boolea… Read more When Is The `==` Operator Not Equivalent To The `is` Operator? (python)

Why Is The Output Different In Both Cases Comparing Floats

PYTHON PROGRAM: a = 0.2 if a == 0.2: print('*') OUTPUT: * C PROGRAM: #include int m… Read more Why Is The Output Different In Both Cases Comparing Floats

Recommended Way To Implement __eq__ And __hash__

The python documentation mentions that if you override __eq__ and the object is immutable, you shou… Read more Recommended Way To Implement __eq__ And __hash__