del and sets proposal

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Sun Oct 5 05:11:38 EDT 2008


In message <00f80c6a$0$20633$c3e8da3 at news.astraweb.com>, Steven D'Aprano
wrote:

> Would it really be "confusing" if sets used the same interface as dicts
> use? I don't think so. What else could "del aset[x]" mean other than
> "delete element x"?

Yes, but "x" in what sense? In dicts it's a key, in sets, shouldn't it also
be a key and not a value?

Sets have no keys, only values. One might suggest assignment of keys, à la
array indexes, but that means assigning an ordering to the values, whereas
sets are explicitly unordered.



More information about the Python-list mailing list