Python built-in functions (28) -- hash, python built-in 28 hash

Source: Internet
Author: User

Python built-in functions (28) -- hash, python built-in 28 hash

English document:

Hash(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.0 ).

 

Note:

1. Return the hash value of the object, represented by an integer. Hash values can be used to quickly compare key values in dictionary search.

>>> Hash ('good good study ') 1032709256

2. Equal values. Even if the types are different, the calculated hash values are the same.

>>> 1.0 = 1 True >>> hash (1.0) 1 >>> hash (1) 1 >>> hash (1.0000) 1

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.