| 10 | |
| 11 | |
| 12 | ===== Why not @datatype |
| 13 | The @datatype annotation from python offers serialization through the {{{asdict}}} method. |
| 14 | However it does not support polymorphism, it does not include the information needed to properly support polymorphism, and it does not offer the reverse method (e.g. from-dict). |
| 15 | |
| 16 | For from-dict functionality, you need to use a third party library, like [https://github.com/Cologler/dataclasses_fromdict-python dataclasses_fromdict], [https://github.com/konradhalas/dacite dacite] or [https://github.com/Fatal1ty/mashumaro mashumaro]. |
| 17 | |
| 18 | But even then polymorphic classes can not be deserialized, because the serialized form just does not contain the information required to do this. |
| 19 | |
329 | | |
330 | | == Why not @datatype |
331 | | The @datatype annotation from python offers serialization through the {{{asdict}}} method. |
332 | | However it does not support polymorphism, it does not include the information needed to properly support polymorphism, and it does not offer the reverse method (e.g. from-dict). |
333 | | |
334 | | From from-dict functionality, you need to use a third party library, like [https://github.com/Cologler/dataclasses_fromdict-python dataclasses_fromdict], [https://github.com/konradhalas/dacite dacite] or [https://github.com/Fatal1ty/mashumaro mashumaro]. |
335 | | |
336 | | But even then polymorphic classes can not be deserialized, because the serialized form just does not contain the information required to do this. |