[Numpy-discussion] Bytes vs. Unicode in Python3

Francesc Alted faltet@pytables....
Fri Dec 4 11:03:05 CST 2009


A Friday 04 December 2009 17:12:09 David Cournapeau escrigué:
> > Mmh, the only case that I'm aware about dtype *mutability* is changing
> > the names of compound types:
> >
> > In [19]: t = np.dtype("i4,f4")
> >
> > In [20]: t
> > Out[20]: dtype([('f0', '<i4'), ('f1', '<f4')])
> >
> > In [21]: hash(t)
> > Out[21]: -9041335829180134223
> >
> > In [22]: t.names = ('one', 'other')
> >
> > In [23]: t
> > Out[23]: dtype([('one', '<i4'), ('other', '<f4')])
> >
> > In [24]: hash(t)
> > Out[24]: 8637734220020415106
> >
> > Perhaps this should be marked as a bug?  I'm not sure about that, because
> > the above seems quite useful.
> 
> Hm, that's strange - I get the same hash in both cases, but I thought
> I took into account names when I implemented the hashing protocol for
> dtype. Which version of numpy on which os are you seeing this ?

numpy: 1.4.0.dev7072
python: 2.6.1

-- 
Francesc Alted


More information about the NumPy-Discussion mailing list