summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-11-11 17:16:28 +0100
committerGitHub <noreply@github.com>2019-11-11 17:16:28 +0100
commite9c267ec05ddf5c9824e83e44bedb4c6be483007 (patch)
tree40b6fbb491f17521497881a4ec57a96e8dee27ab
parentd552f0f1862298039db85600c2f67de3cfdcb227 (diff)
parentecd572073c0d2cd18f4bb0f8a23b2da086f02006 (diff)
Merge pull request #33540 from Calinou/doc-dictionary-hash-equality
Mention that `Dictionary.hash()` can be used for equality comparisons
-rw-r--r--doc/classes/Dictionary.xml8
1 files changed, 7 insertions, 1 deletions
diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml
index 831a0bb02f..7cb6b1b754 100644
--- a/doc/classes/Dictionary.xml
+++ b/doc/classes/Dictionary.xml
@@ -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">