SHARE
TWEET

Untitled

a guest Jun 18th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Forward:
  2.  
  3.     def resolve(self, env):
  4.         raise NotImplementedError()
  5.  
  6.     def op(self, op, rhs):
  7.         if not isinstance(rhs, Forward):
  8.             raise TypeError('"{}" not of type `Forward`'.format(rhs))
  9.         return Evaluation(op, self, rhs)
  10.  
  11.     __eq__ = partialmethod(op, operator.__eq__)
  12.     __gt__ = partialmethod(op, operator.__gt__)
  13.     __lt__ = partialmethod(op, operator.__lt__)
  14.     __ge__ = partialmethod(op, operator.__ge__)
  15.     __le__ = partialmethod(op, operator.__le__)
  16.  
  17.     __add__ = partialmethod(op, operator.__add__)
  18.     __sub__ = partialmethod(op, operator.__sub__)
  19.     __mul__ = partialmethod(op, operator.__mul__)
  20.     __truediv__ = partialmethod(op, operator.__truediv__)
  21.     __floordiv__ = partialmethod(op, operator.__floordiv__)
  22.     __pow__ = partialmethod(op, operator.__pow__)
  23.  
  24.     __iadd__ = partialmethod(op, operator.__iadd__)
  25.     __isub__ = partialmethod(op, operator.__isub__)
  26.     __imul__ = partialmethod(op, operator.__imul__)
  27.     __itruediv__ = partialmethod(op, operator.__itruediv__)
  28.     __ifloordiv__ = partialmethod(op, operator.__ifloordiv__)
  29.     __ipow__ = partialmethod(op, operator.__ipow__)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top