Aug-22-2019, 07:29 AM
λ python Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> hash(2) 2 >>> hash(1) 1 >>> hash(0) 0 >>> hash(-1) -2 >>> hash(-2) -2 >>> hash(-3) -3 >>>If you check values for equality, don't use identity checks (is/is not). Use equality check for integers and comparison for floats.
If you want to check for Types of objects, which exists only once in memory, it's save to use the
is
operator.*to check floats of equality, use math.isclose.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!