Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我编写了一个自定义映射类,它继承自collections.Mapping. 有没有一种简单的方法来测试一个实例的数据是否等于另一个映射对象,例如dict?
collections.Mapping
dict
当然。编写__eq__和__ne__执行此比较的方法。
__eq__
__ne__