Collection Attributes

collections.defaultdict.default_factory

Writable factory used by missing-key subscription. Set it to None to disable automatic creation.

Formal Syntax & Structure

python syntaxpython
mapping.default_factory

Return Value

callable or None

The callable or None result described above.

Working Example

Example Snippetpython
import collectionsd=collections.defaultdict(list)print(d.default_factory is list)
Python Reference