Python's simplicity philosophy
Andrew Dalke
adalke at mindspring.com
Sun Nov 16 19:44:25 EST 2003
Paul Rubin:
> "Andrew Dalke" <adalke at mindspring.com> writes:
[actually, I was quoting from the python-dev summary of Brett C's.
Paul:
> Changing the behavior of list.sort would be really bad, but I
> certainly favor adding a new method (maybe list.nsort). There should
> also be list.nuniq which takes a sorted list and strips duplicate
> elements.
Do you want unix-style unique where repeats are merged into
one, so that 1 2 2 1 -> 1 2 1 or do you want it to return
items which only occur once, and you don't care about the
order (as in dict.from_keys([1, 2, 2, 1]).keys() which can
return [1, 2] or [2, 1]) or do you want the order of the keys
in the final list to maintain the same order as the initial list,
so that [2, 1, 1, 2] -> [2, 1] always?
Andrew
dalke at dalkescientific.com
More information about the Python-list
mailing list