Sets in Python

Neil Cerutti horpner at yahoo.com
Thu Sep 20 13:03:02 EDT 2007


On 2007-09-20, Marc 'BlackJack' Rintsch <bj_666 at gmx.net> wrote:
>> In the new model, it should be the value at the time of
>> addition. That is [1,2] (not [1,2,3]). This does mean a copy
>> of key in maintained internally in the dict.
>
> A copy!?  That has to be a deep copy.  Which would make
> `dict`\s alot slower and use more memory.  Plus you can't store
> objects that can't be copied anymore.  That doesn't sound like
> a good trade off to me.

Python's dict implementation is so deeply unorthoganal (is that a
word?) to Python's basic assignment semantics and clever type
hierarchy that it's hard to even sensibly promote anything other
than the current implementation without completely redesigning
Python.

-- 
Neil Cerutti



More information about the Python-list mailing list