Sets in Python

Paddy paddy3118 at googlemail.com
Thu Sep 20 02:28:35 EDT 2007


On Sep 20, 5:02 am, Karthik Gurusamy <kar1... at gmail.com> wrote:
> In the new model, at the time of addition, you need to remember the
> key at that time. If it's a list, you make a copy of the items.
In other words you ask the dict to freeze any mutable keys given to
it.
Try an implementation and you will find it is impractical. Checking
for mutability then doing deep copies of keys and  would consume time
in something that greatly affects the speed of Python as a whole.
Pythons designers give *you* the option of doing this and leave the
underlying dict speedy. I can live with that.

- Paddy.





More information about the Python-list mailing list