[SciPy-dev] are arrays hashable?
Alan G Isaac
aisaac at american.edu
Tue Sep 20 10:44:46 CDT 2005
On Tue, 20 Sep 2005, Robert Kern apparently wrote:
> Alan G Isaac wrote:
>> A function that used to work fine with SciPy arrays
>> now chokes on the new scipy.base, claiming that
>> the new arrays are an unhashable type.
>> For illustration only:
>>>>> from scipy.base import *
>>>>> d = arange(11)
>>>>> set(d)
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in ?
>> TypeError: unhashable type
> Arrays were never hashable, nor should they be since they are mutable.
Right. Sorry. But see below.
> The problem here is that set() isn't recognizing the array as an
> iterable. With a slightly old CVS checkout, I get
Actually iterability is recognized.
I can get a list from an array.
But the elements of the list are type long_arrtype,
which are not hashable! Surely these should be hashable?
All variants of arrtype are apparently not considered
hashable types.
In the meantime, how can I produce a list of hashable types
from a ndarray?
Thank you,
Alan Isaac
More information about the Scipy-dev
mailing list