Nick Coghlan wrote: > I hadn't really thought about it that way before this discussion - it > is the identity checking behaviour of the builtin containers that lets > us sensibly handle cases like sets of NumPy arrays. Except that it doesn't: >>> from numpy import array >>> a1 = array([1,2]) >>> a2 = array([3,4]) >>> s = set([a1, a2]) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unhashable type: 'numpy.ndarray' Lists aren't trouble-free either: >>> lst = [a1, a2] >>> a2 in lst Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() -- Greg
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4