Generally, you should consider dunder/magic methods to be the implementation and invoking functions/methods as the API, so it would be preferable to use vars()
over __dict__
, in the same way that you would do len(a_list)
and not a_list.__len__()
, or a_dict["key"]
rather than a_dict.__getitem__('key')
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…