On Feb 28, 2:18 pm, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > Unicode fix (untested): > > def unique(seq, keepstr=True): > t = type(seq) > if t in (unicode, str): > t = (list, t('').join)[bool(keepstr)] > seen = [] > return t(c for c in seq if not (c in seen or seen.append(c)))
This definitely works. I tried to post a message about this a few hours ago, but I guess it didn't go through. I've already updated the recipe and comments. > I think these iterator approaches get more readable as one becomes > used to them. I agree. I understood your code in a matter of seconds. -- http://mail.python.org/mailman/listinfo/python-list