You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's fine to add this feature later, but my worry is that the currently suggested way to convert ItemAdapter to a dict (dict(adapter)) is not future-proof; I'm not sure how to add nesting support to it in future, if we decide to. Likely it would require updating of all examples.
So, what do you think about adding a method (something like ItemAdapter.asdict()), and recommending it? It may support recursive export from the day 1, or just call dict(self) - in this case recursive=True flag can be added later.
The text was updated successfully, but these errors were encountered:
It would be cool to be able to convert an item to a nested dictionary. Both with dataclasses and with attr.s you can define nested data:
Such structures are common in real-world usage of these packages. For example, attr.s provides an utility to convert a nested structure to a dict: https://www.attrs.org/en/stable/api.html#attr.asdict.
That's fine to add this feature later, but my worry is that the currently suggested way to convert ItemAdapter to a dict (
dict(adapter)
) is not future-proof; I'm not sure how to add nesting support to it in future, if we decide to. Likely it would require updating of all examples.So, what do you think about adding a method (something like
ItemAdapter.asdict()
), and recommending it? It may support recursive export from the day 1, or just calldict(self)
- in this caserecursive=True
flag can be added later.The text was updated successfully, but these errors were encountered: