Update documentation of `dict`, mention it's mutable.
RELNOTES: None.
@@ -31,13 +31,15 @@ import javax.annotation.Nullable;
"A language built-in type representating a dictionary (associative mapping). "
+ "Dictionaries may be constructed with a special literal syntax:<br>"
+ "<pre class=\"language-python\">d = {\"a\": 2, \"b\": 5}</pre>"
+ + "See also the <a href=\"globals.html#dict\">dict()</a> constructor function. "
+ "When using the literal syntax, it is an error to have duplicated keys. "
+ "Use square brackets to access elements:<br>"
+ "<pre class=\"language-python\">e = d[\"a\"] # e == 2</pre>"
+ "Like lists, they can also be constructed using a comprehension syntax:<br>"
+ "<pre class=\"language-python\">d = {i: 2*i for i in range(20)}\n"
+ "e = d[8] # e == 16</pre>"
- + "See also the <a href=\"globals.html#dict\">dict()</a> constructor function. "
+ + "Dictionaries are mutable. You can add new elements or mutate existing ones:"
+ + "<pre class=\"language-python\">d[\"key\"] = 5</pre>"
+ "<p>Iterating over a dict is equivalent to iterating over its keys. The "
+ "<code>in</code> operator tests for membership in the keyset of the dict.<br>"
+ "<pre class=\"language-python\">\"a\" in {\"a\" : 2, \"b\" : 5} "
