Skip to content

use classmethod to create a instance instead of staticmethod for more idiomatic python codeΒ #14

@fishronsage

Description

@fishronsage

Currently, the codebase uses staticmethod as an alternate constructor. However, I believe that in the Python world, using classmethod is more idiomatic. staticmethod is typically used for utility functions that logically belong to the class.

https://docs.python.org/3/library/functions.html#staticmethod

Static methods in Python are similar to those found in Java or C++. Also, see classmethod() for a variant that is useful for creating alternate class constructors.

and some refers:

(not saying staticmethod is wrong, just want to be more idiomatic πŸ˜„πŸ˜)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions