为了使这项工作,我需要改变什么?
class A: @staticmethod def __getitem__(val): return "It works" print A[0]
请注意,我__getitem__在类型上调用方法A.
__getitem__
A
python static magic-methods operator-keyword
magic-methods ×1
operator-keyword ×1
python ×1
static ×1