[Python-Dev] PEP270 (list.uniq())

Padraig Brady padraig.brady@corvil.com
Fri, 01 Nov 2002 17:29:20 +0000

Hi Jason,

I was just reading this and it seems
to overlap with: http://www.python.org/peps/pep-0218.html
I.E. uniq is equivalent to union (with self).

wrt to the uniq command line tool, if you've 2 files a & b, then:

uniq    a b =3D union
uniq -u a b =3D difference
uniq -d a b =3D intersection

So uniq really is a set operation and if Python had
a set builtin type then I'm not sure a uniq method
would be required? Perhaps the list object could
support the union operator so to uniqify a list you
could do:

mylist |=3D mylist