Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e7dfe74

Browse files
committed
Add entry for hash_info().
1 parent 9a236b0 commit e7dfe74

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Doc/whatsnew/3.2.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,14 @@ values are equal (:issue:`8188`)::
11061106
assert hash(Fraction(3, 2)) == hash(1.5) == \
11071107
hash(Decimal("1.5")) == hash(complex(1.5, 0))
11081108

1109+
Some of the hashing details are exposed through a new attribute,
1110+
:attr:`sys.hash_info`, which describes the bit width of the hash value, the
1111+
prime modulus, the hash values for *infinity* and *nan*, and the multiplier
1112+
used for the imaginary part of a number:
1113+
1114+
>>> sys.hash_info
1115+
sys.hash_info(width=64, modulus=2305843009213693951, inf=314159, nan=0, imag=1000003)
1116+
11091117
An early decision to limit the inter-operability of various numeric types has
11101118
been relaxed. It is still unsupported (and ill-advised) to have implicit
11111119
mixing in arithmetic expressions such as ``Decimal('1.1') + float('1.1')``

0 commit comments

Comments
 (0)