aptos-labs / aptos-python-sdk

Aptos Python SDK
11 stars 7 forks source link

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

Open fishronsage opened 1 week ago

fishronsage commented 1 week ago

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 😄😁)