From 3d6be10ebe9880b90d5874fc732ad44b7d80ee3b Mon Sep 17 00:00:00 2001 From: Pamela McA'Nulty Date: Tue, 17 Apr 2012 12:31:13 -0400 Subject: [PATCH] tuple subclasses don't get __init__, they get __new__ Signed-off-by: Pamela McA'Nulty --- src/wstools/XMLSchema.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/wstools/XMLSchema.py b/src/wstools/XMLSchema.py index 62ced8f..ff696f0 100755 --- a/src/wstools/XMLSchema.py +++ b/src/wstools/XMLSchema.py @@ -3095,17 +3095,16 @@ else: class TypeDescriptionComponent(tupleClass): """Tuple of length 2, consisting of a namespace and unprefixed name. - """ - def __init__(self, args): + """ + def __new__(typ, args): """args -- (namespace, name) Remove the name's prefix, irrelevant. """ if len(args) != 2: raise TypeError, 'expecting tuple (namespace, name), got %s' %args elif args[1].find(':') >= 0: - args = (args[0], SplitQName(args[1])[1]) - tuple.__init__(self, args) - return + args = (args[0], SplitQName(args[1])[1]) + return tuple.__new__(typ, args) def getTargetNamespace(self): return self[0]