src/reportlab/lib/set_ops.py
branchpy33
changeset 3721 0c93dd8ff567
parent 3617 ae5744e97c42
child 3794 398ea04239b5
--- a/src/reportlab/lib/set_ops.py	Fri Feb 15 15:54:16 2013 +0000
+++ b/src/reportlab/lib/set_ops.py	Tue Apr 30 14:20:22 2013 +0100
@@ -9,11 +9,11 @@
 import string
 
 def __set_coerce(t, S):
-    if t is types.ListType:
+    if t is list:
         return list(S)
-    elif t is types.TupleType:
+    elif t is tuple:
         return tuple(S)
-    elif t is types.StringType:
+    elif t is bytes:
         return string.join(S, '')
     return S
 
@@ -26,7 +26,7 @@
 
 def intersect(seq1, seq2):
     result = []
-    if type(seq1) != type(seq2) and type(seq2) == types.StringType: seq2 = list(seq2)
+    if type(seq1) != type(seq2) and type(seq2) == bytes: seq2 = list(seq2)
     for i in seq1:
         if i in seq2 and i not in result: result.append(i)
     return __set_coerce(type(seq1), result)
@@ -34,8 +34,8 @@
 def union(seq1, seq2):
     if type(seq1) == type(seq2):
         return unique(seq1 + seq2)
-    if type(seq1) == types.ListType or type(seq2) == types.ListType:
+    if type(seq1) == list or type(seq2) == list:
         return unique(list(seq1) + list(seq2))
-    if type(seq1) == types.TupleType or type(seq2) == types.TupleType:
+    if type(seq1) == tuple or type(seq2) == tuple:
         return unique(tuple(seq1) + tuple(seq2))
     return unique(list(seq1) + list(seq2))