Skip to content

Commit 7544497

Browse files
gfrlvmatrixise
authored andcommitted
Doc: Add example of dict() function with positional and keyword arguments (GH-15220)
1 parent 6e1a30b commit 7544497

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Doc/library/stdtypes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4213,7 +4213,8 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
42134213
>>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))
42144214
>>> d = dict([('two', 2), ('one', 1), ('three', 3)])
42154215
>>> e = dict({'three': 3, 'one': 1, 'two': 2})
4216-
>>> a == b == c == d == e
4216+
>>> f = dict({'one': 1, 'three': 3}, two=2)
4217+
>>> a == b == c == d == e == f
42174218
True
42184219

42194220
Providing keyword arguments as in the first example only works for keys that

0 commit comments

Comments
 (0)