Python的魔法方法:__init__(),__getitem__()和__len__()
Python的魔法方法(Magic Method)是Python的一种高级语法,允许你在类中自定义方法,魔法方法的命名格式为以双下划线开头并以双下划线结尾,例如:__xxx__()。
当Python解释器遇到特殊句法时,会去自动调用特殊方法,例如:
class FUN():
# Magic Method: __str__
def __str__(self) -> str:
