我是python的新手。我听说,对于python而言,即使是类或函数,一切都是对象。
据我所知,该类对象是在程序启动时创建的。因此,我想知道是否存在用于初始化类变量或执行某些操作的功能。
init 函数无法执行,因为它的参数是self,它是类的实例。我想访问该类本身。
class Example():
def __init__(self):
# I know that this function is called when an instance of this class is created
pass
def __something__(cls):
# Is there some function for initializing class object?
# What I wanna do is I want to initialize class variables or call some functions...
# But __init__ function can't do because its parameter is self.
pass