pythonで独自クラスにsetを使う
pythonで独自クラスに対してsetを使うには、そのクラスがhashableでなければならない。
hashableであるとは、__hash__()
メソッドと__eq__()
メソッドを持っていることを指す。
python - How to implement __eq__ for set inclusion test? - Stack Overflow
pythonで独自クラスに対してsetを使うには、そのクラスがhashableでなければならない。
hashableであるとは、__hash__()
メソッドと__eq__()
メソッドを持っていることを指す。
python - How to implement __eq__ for set inclusion test? - Stack Overflow