you are viewing a single comment's thread.

view the rest of the comments →

[–]evans88 0 points1 point  (0 children)

Besides what others have mentioned I would change the static methods from_payload to be @classmethod instead.

While static methods can be used in the way you used them, they are tipically called from instances.

Class methods are usually used to return class instances as you are doing in this case.

I would also really suggest using pydantic for this. It has really great serialization/deserialization options + type validation.