src/reportlab/lib/set_ops.py
branchpy33
changeset 3794 398ea04239b5
parent 3721 0c93dd8ff567
equal deleted inserted replaced
3793:cc3f9cc828f7 3794:398ea04239b5
     4 #history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/set_ops.py
     4 #history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/set_ops.py
     5 __version__=''' $Id$ '''
     5 __version__=''' $Id$ '''
     6 __doc__="""From before Python had a Set class..."""
     6 __doc__="""From before Python had a Set class..."""
     7 
     7 
     8 import types
     8 import types
     9 import string
       
    10 
     9 
    11 def __set_coerce(t, S):
    10 def __set_coerce(t, S):
    12     if t is list:
    11     if t is list:
    13         return list(S)
    12         return list(S)
    14     elif t is tuple:
    13     elif t is tuple:
    15         return tuple(S)
    14         return tuple(S)
    16     elif t is bytes:
    15     elif t is bytes:
    17         return string.join(S, '')
    16         return ''.join(S)
    18     return S
    17     return S
    19 
    18 
    20 def unique(seq):
    19 def unique(seq):
    21     result = []
    20     result = []
    22     for i in seq:
    21     for i in seq: