Message353116
I checked and it appears that `attrs` handles this by creating *all* dicts using the default dict_factory (similar to my original suggestion of just using `dict` instead of the specific type), if I'm reading this right: https://github.com/python-attrs/attrs/blob/master/src/attr/_funcs.py#L102
Using `attr.asdict` seems to bear this out, as `defaultdict` attributes are converted to `dict` when the dict factory is not specified.
I think changing the default behavior like that would be a backwards-incompatible change at this point (and one that it's really hard to warn about, unfortunately), but we could still use the "fall back to dict_factory" behavior by trying to construct a `type(obj)(...)` and in the case of an exception return `dict_factory(...)`. |
|
Date |
User |
Action |
Args |
2019-09-24 19:48:27 | p-ganssle | set | recipients:
+ p-ganssle, eric.smith, levkivskyi, wrmsr, remi.lapeyre |
2019-09-24 19:48:27 | p-ganssle | set | messageid: <1569354507.89.0.562930811554.issue35540@roundup.psfhosted.org> |
2019-09-24 19:48:27 | p-ganssle | link | issue35540 messages |
2019-09-24 19:48:27 | p-ganssle | create | |
|