There would be some implementation consequences in terms of speed and
memory usage (we would lose the memory savings and some of the speed-ups
gained in the Py2.5 implementation of sets).
Is that really necessary? Couldn't the keys and values be
kept in separate arrays, and only allocate the values array
the first time a non-canonical value is inserted?
That would forgo cache locality and would slow-down general purpose
dicts.
Guido listed the basic conflicts 1) arbitrary decisions as to which
values to keep, 2) unexpected stings from != and == taking values into
account, 3) operations that don't make sense (__setitem__, setdefault,
etc).
> ...
> assert a|b == b|a, 'commutative property'
> assert (a-b) | (a&b) | (b-a) == a|b, 'whole is the sum of the parts'
These could be resolved by refusing to carry out set
operations on a dict which contains non-canonical values.
Guido's example specifically demonstrated set-ops on non-canonical
sets. Also, having setops for general dictionaries was listed as one
of the advantages of unification.
Raymond
|
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com