Skip to content

TelegramObject.de_json should be @classmethod #734

@ihoru

Description

@ihoru

All de_json methods should be @classmethod, not @staticmethod. Because almost everywhere inside of them you can see something like this:

    @staticmethod
    def de_json(data, bot):
        ...
        return Update(**data)

Instead of:

    @classmethod
    def de_json(cls, data, bot):
        ...
        return cls(**data)
  1. Did you have any valuable reasons to do so?
  2. If not, I can change this and open PR. Do you want me to do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions