ericvsmith / dataclasses

Apache License 2.0
584 stars 53 forks source link

Support fromdict #131

Closed maximveksler closed 6 years ago

maximveksler commented 6 years ago

Given class

@dataclass 
class A:
   a: str
   b: [A] = None
   c: {str: [A]} = None

a = A("foo")

It would be extremely useful, to be able to do something like this

a == fromdict(A, asdict(a))

True

ericvsmith commented 6 years ago

Can you bring this up on the python-ideas mailing list? This repo is just for the backport to Python 3.6. Thanks.