Python Infinity Hash Surprise
>>> inf = float("infinity") >>> inf inf >>> hash(inf) 314159 >>> hash(-inf) -314159 >>>
A Python interactive shell shows that positive and negative infinity have hash values of 314159 and -314159. The joke is that Python uses digits of pi for infinity’s hash, creating an unexpectedly mathematical programming detail that works as a nerdy reaction to something boundless or absurd. EN: A Python interactive shell shows that positive and negative infinity have hash values of 314159 and -314159. The joke is that Python uses digits of pi for infinity’s hash, creating an unexpectedly mathematical programming detail that works as a nerdy reaction to something boundless or absurd.
computer terminal / компьютерный терминалPython code / код Pythoninteractive shell / интерактивная оболочкаtext cursor / текстовый курсорmonospace text / моноширинный текстblack background / чёрный фонwhite text / белый текстinfinity value / значение бесконечностиnumber 314159 / число 314159minus sign / знак минус
- @ithueti / 14990 2025-01-08
- Type
- image
- Size
- 720×277 · 13.5 KiB
- Mood
- nerdy, absurd
- Language
- en
- Added