DC 2
[자료구조] 좌석구매 파이썬 (hashable VS. unhashable)
YGSEO
2021. 4. 22. 01:25
728x90
unique한 pair를 구하면 될거라 생각해서
2d 리스트를 그대로 set에 넣었지만
TypeError: unhashable type: 'list'
unhashable 에러가 발생했다.
문제를 마저 풀기 전에 unhashable과 hashable의 차이점을 알아보자.

출처: realpython.com/lessons/immutable-vs-hashable/
hashable object라는 것은 can't modify 정도로 이해가 가능한데
좀 더 설명이 필요하기 때문에 다른 글을 찾아봤다.


요약: non-duplicate를 요구하는 python object들은 hashable하다.
출처: https://analytics4everything.tistory.com/m/138
728x90