Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

The hash of infinity in Python has digits matching pi:

>>> inf = float('inf') 

>>> hash(inf) 314159 

>>> int(math.pi*1e5) 

314159

Is that just a coincidence or is it intentional?

1 Answer

0 votes
by (106k points)

Because the _PyHASH_INF is defined as a constant equal to 314159.

Related questions

0 votes
1 answer
asked Sep 26, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Oct 29, 2019 in Java by Anvi (10.2k points)
0 votes
2 answers
asked Jul 12, 2019 in Java by Aditya98 (1.3k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...