Skip to content

Commit df5f768

Browse files
Update docs for duplicate-key-in-dict-literal to relate. to python 3
1 parent 2ed54d5 commit df5f768

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
dictionary = {1:"a", 2:"b", 2:"c"}
2-
print dictionary[2]
1+
dictionary = {1:"a", 2:"b", 2:"c"} # BAD: `2` key is duplicated.
2+
print(dictionary[2])

python/ql/src/Expressions/DuplicateKeyInDictionaryLiteral.qhelp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<qhelp>
55
<overview>
66
<p>Dictionary literals are constructed in the order given in the source.
7-
This means that if a key is duplicated the second key-value pair will overwrite
8-
the first as a dictionary can only have one value per key.
7+
This means that if a key is duplicated, the second key-value pair will overwrite
8+
the first; as a dictionary can only have one value per key.
99
</p>
1010

1111
</overview>
@@ -15,14 +15,14 @@ If they are then decide which value is wanted and delete the other one.</p>
1515

1616
</recommendation>
1717
<example>
18-
<p>This example will output "c" because the mapping between 2 and "b" is overwritten by the
19-
mapping from 2 to "c". The programmer may have meant to map 3 to "c" instead.</p>
18+
<p>The following example will output <code>"c"</code>, because the mapping between 2 and <code>"b"</code> is overwritten by the
19+
mapping from 2 to <code>"c"</code>. The programmer may have meant to map 3 to <code>"c"</code> instead.</p>
2020
<sample src="DuplicateKeyInDictionaryLiteral.py" />
2121

2222
</example>
2323
<references>
2424

25-
<li>Python: <a href="http://docs.python.org/2/reference/expressions.html#dictionary-displays">Dictionary literals</a>.</li>
25+
<li>Python: <a href="http://docs.python.org/3/reference/expressions.html#dictionary-displays">Dictionary literals</a>.</li>
2626

2727
</references>
2828
</qhelp>

0 commit comments

Comments
 (0)