我直接在这样的类上调用一个方法:
MyClass.action("Hello World!")
在被调用的方法中,我需要引用另一个方法:
class MyClass:
def action(data):
print('first')
# vvv How to perform this call?
next_action(data)
def next_action(data):
print('second', data)
通常,我会使用self
to access the method and attributes,但通过调用类上的方法,self
无法引用任何实例.在这种情况下,我如何从一种方法访问另一种方法?