[Numpy-discussion] Bytes vs. Unicode in Python3

David Cournapeau cournape at gmail.com
Sat Dec 5 10:21:58 EST 2009


On Sat, Dec 5, 2009 at 7:16 PM, Dag Sverre Seljebotn
<dagss at student.matnat.uio.no> wrote:

>> Perhaps this should be marked as a bug?  I'm not sure about that, because the
>> above seems quite useful.
>
> Well, I for one don't like this, but that's just an opinion. I think it
> is unwise to leave object which supports hash() mutable, because it's
> too easy to make hard to find bugs (sticking a dtype as a key in a dict
> is rather useful in many situations). There's a certain tradition in
> Python for leaving types immutable if possible, and dtype certainly
> feels like it.

I agree the behavior is a bit surprising, but I don't know if code
relies on "compound" dtype names to be immutable out there. Also, the
fact that names attribute is a tuple and not a list also suggests that
the intent is to be immutable.

I am more worried about the variations between python versions ATM,
though, I have no idea where it is coming from.

David



More information about the NumPy-Discussion mailing list