[issue44674] dataclasses should allow frozendict default value

Arjun report at bugs.python.org
Fri Jul 23 17:28:26 EDT 2021


Arjun <ccldarjun at icloud.com> added the comment:

Which frozendict does your message concern? I found this in some test: https://github.com/python/cpython/blob/bb3e0c240bc60fe08d332ff5955d54197f79751c/Lib/test/test_builtin.py#L741 or are you suggesting any user defined immutable object?

I'm not sure indicating that an object should be immutable to dataclasses will be less cumbersome than default_factory.

Currently, you have to do this:
> x: frozendict = field(default_factory=frozendict)

But, indicating mutability would be something like this:
> x: frozendict = field(mutable=false)

----------
nosy: +CCLDArjun

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44674>
_______________________________________


More information about the Python-bugs-list mailing list