From 8dd90bc85af1ff36e794534157265ff767fc0d9a Mon Sep 17 00:00:00 2001 From: Lafrite Date: Mon, 22 Dec 2014 11:53:32 +0100 Subject: [PATCH] change way to build fake --- pymath/operator.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pymath/operator.py b/pymath/operator.py index 975772a..419f269 100644 --- a/pymath/operator.py +++ b/pymath/operator.py @@ -159,12 +159,13 @@ def save_mainOp(obj, mainOp): :mainOp: the main operator :returns: the same object with the main operation attribute """ - class Fake(type(obj)): - """ The fake class """ - def __new__(cls, obj): - op = type(obj).__new__(cls, obj) - op.mainOp = mainOp - return op + #class Fake(type(obj)): + # """ The fake class """ + # def __new__(cls, obj): + # op = type(obj).__new__(cls, obj) + # op.mainOp = mainOp + # return op + Fake = type('fake_'+str(type(obj)), (type(obj),), {'mainOp': mainOp}) return Fake(obj)