Skip to content

Commit 97972f6

Browse files
committed
Add doctest
1 parent 3f1daea commit 97972f6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Doc/library/collections.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,11 @@ stack manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``,
731731
will create a dict with a key of ``'default_factory'`` and a value of
732732
:class:`list`. Instead, call ``defaultdict(list)``.
733733

734+
>>> defaultdict(default_factory=list)
735+
defaultdict(None, {'default_factory': <class 'list'>})
736+
>>> defaultdict(list)
737+
defaultdict(<class 'list'>, {})
738+
>>>
734739

735740
:class:`defaultdict` objects support the following method in addition to the
736741
standard :class:`dict` operations:

0 commit comments

Comments
 (0)