Python內建hash函數的詳細介紹

高洛峰
發布: 2017-03-21 10:52:26
原創
2525 人瀏覽過

英文文件:

<a href="http://www.php.cn/wiki/739.html" target="_blank">hash</a>#(object)Return the hash value of the object (if it has one). Hash values are integers. They are used to quickly compare dictionary keys during a dictionary lookup. Numeric values that compare equal have the same hash value (even if they are of different types, as is the case ##for## 1 and# 1.# . 

說明:  

#  1. 傳回

物件

的雜湊值,用整數#表示。哈希值在字典中查找時,可用來快速比較鍵的值。

  2. 相等的數值,即使型別不一致,計算的雜湊值是一樣的。

>>> 1.0 == 1
True
>>> hash(1.0)
>>> hash(1)
>>> hash(1.0000)
登入後複製

以上是Python內建hash函數的詳細介紹的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!