Merge pull request #33540 from Calinou/doc-dictionary-hash-equality

Mention that `Dictionary.hash()` can be used for equality comparisons
This commit is contained in:
Rémi Verschelde 2019-11-11 17:16:28 +01:00 committed by GitHub
commit e9c267ec05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,7 +83,13 @@
<return type="int">
</return>
<description>
Returns a hashed integer value representing the dictionary contents.
Returns a hashed integer value representing the dictionary contents. This can be used to compare dictionaries by value:
[codeblock]
var dict1 = {0: 10}
var dict2 = {0: 10}
# The line below prints `true`, whereas it would have printed `false` if both variables were compared directly.
print(dict1.hash() == dict2.hash())
[/codeblock]
</description>
</method>
<method name="keys">