Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a20879f

Browse files
committed
#16206: Improve examples about dict construction.
1 parent c131b07 commit a20879f

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Doc/library/stdtypes.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2137,13 +2137,13 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
21372137
replaces the value from the positional argument.
21382138

21392139
To illustrate, the following examples all return a dictionary equal to
2140-
``{"one": 1, "two": 2}``::
2140+
``{"one": 1, "two": 2, "three": 3}``::
21412141

2142-
>>> a = dict(one=1, two=2)
2143-
>>> b = dict({'one': 1, 'two': 2})
2144-
>>> c = dict(zip(('one', 'two'), (1, 2)))
2145-
>>> d = dict([['two', 2], ['one', 1]])
2146-
>>> e = {"one": 1, "two": 2}
2142+
>>> a = dict(one=1, two=2, three=3)
2143+
>>> b = {'one': 1, 'two': 2, 'three': 3}
2144+
>>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))
2145+
>>> d = dict([('two', 2), ('one', 1), ('three', 3)])
2146+
>>> e = dict({'three': 3, 'one': 1, 'two': 2})
21472147
>>> a == b == c == d == e
21482148
True
21492149

0 commit comments

Comments
 (0)