[issue23372] defaultdict.fromkeys should accept a callable factory

Serhiy Storchaka report at bugs.python.org
Sun Feb 1 19:53:22 CET 2015


Serhiy Storchaka added the comment:

It may be written simpler:

    d = defaultdict(factory)
    for i in constants:
        d[i]

or

    d = defaultdict(factory, {i: factory() for i in constants})

I'm inclined to reject this proposition. It serves very special use case.

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23372>
_______________________________________


More information about the Python-bugs-list mailing list