Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yep, here's how it plays out:

  Python 3.8.5 (default, Sep  4 2020, 02:22:02) 
  [Clang 10.0.0 ] :: Anaconda, Inc. on darwin
  >>> d=dict()
  >>> l=[1,2,3]
  >>> d[l]=42
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: unhashable type: 'list'


https://pypi.org/project/forbiddenfruit/

Apparently there are ways to monkey patch core types, so you could probably add a __hash__ method to list…




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: