"Paul McGuire" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
On May 20, 10:50 am, [EMAIL PROTECTED] wrote:
> def compress(s):
> return list(set(s))
>
> That does the trick.

Wow, I just *knew* there had to be some built-in function that would make 
this problem trivial! :)

Only if order does not need to be maintained.  list(set(s)) will not
necessarily keep the unique characters in the order they are seen.
We'll have to check with the OP to see if this is important (I just
assumed that it was because of the use of list comps).

Good point. For me it doesn't matter because it wasn't my problem 
originally. I just had a question about the list comp. But if order matters, 
then I guess set doesn't work? 


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to