Close fewer tags.
Closes
@@ -50,7 +50,7 @@ import net.starlark.java.annot.StarlarkMethod;
+ " by calling certain methods. Dictionaries are iterable; iteration yields the"
+ " sequence of keys in insertion order. Iteration order is unaffected by updating the"
+ " value associated with an existing key, but is affected by removing then"
- + " reinserting a key.</p>\n"
+ + " reinserting a key.\n"
+ "<pre>d = {0: 0, 2: 2, 1: 1}\n"
+ "[k for k in d] # [0, 2, 1]\n"
+ "d.pop(2)\n"
@@ -58,16 +58,16 @@ import net.starlark.java.annot.StarlarkMethod;
+ "0 in d, \"a\" in d # (True, False)\n"
+ "[(k, v) for k, v in d.items()] # [(0, \"a\"), (1, 1), (2, \"b\")]\n"
+ "</pre>\n"
- + "<p>There are three ways to construct a dictionary:</p>\n"
+ + "<p>There are three ways to construct a dictionary:\n"
+ "<ol>\n"
+ "<li>A dictionary expression <code>{k: v, ...}</code> yields a new dictionary with"
+ " the specified key/value entries, inserted in the order they appear in the"
+ " expression. Evaluation fails if any two key expressions yield the same"
- + " value.</p>\n"
+ + " value.\n"
+ "<li>A dictionary comprehension <code>{k: v for vars in seq}</code> yields a new"
+ " dictionary into which each key/value pair is inserted in loop iteration order."
+ " Duplicates are permitted: the first insertion of a given key determines its"
- + " position in the sequence, and the last determines its associated value.</p>\n"
+ + " position in the sequence, and the last determines its associated value.\n"
+ "<pre class=\"language-python\">\n"
+ "{k: v for k, v in ((\"a\", 0), (\"b\", 1), (\"a\", 2))} # {\"a\": 2, \"b\": 1}\n"
+ "{i: 2*i for i in range(3)} # {0: 0, 1: 2, 2: 4}\n"
