Commit 4a893224 authored by Philipp Arras's avatar Philipp Arras

Merge branch '21-revert-automatical-casting-of-field-to-model' into 'NIFTy_5'

Resolve "Revert automatical casting of Field to model"

Closes #21

See merge request ift/nifty-dev!12
parents e53f2d33 54aa8414
......@@ -50,10 +50,7 @@ class Model(NiftyMetaBase()):
if isinstance(other, Model):
from .binary_helpers import Add
return Add.make(self, other)
if isinstance(other, (Field, MultiField)):
from .constant import Constant
return self.__add__(Constant(self.position, other))
raise TypeError
return NotImplemented
def __sub__(self, other):
return self.__add__((-1) * other)
......@@ -67,12 +64,12 @@ class Model(NiftyMetaBase()):
return Mul.make(self, other)
if isinstance(other, (Field, MultiField)):
return makeOp(other)(self)
raise NotImplementedError
return NotImplemented
def __rmul__(self, other):
if isinstance(other, (float, int, Field)):
return self.__mul__(other)
raise NotImplementedError
return NotImplemented
def __str__(self):
s = ('----------------------------------------'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment