-
-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathsub.py
More file actions
17 lines (13 loc) · 499 Bytes
/
sub.py
File metadata and controls
17 lines (13 loc) · 499 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# pylint: disable=too-few-public-methods
"The Subtract Decorator"
from interface_value import IValue
class Sub(IValue):
"A Decorator that subtracts a number from a number"
def __init__(self, val1, val2):
# val1 and val2 can be int or the custom Value
# object that contains the `value` attribute
val1 = getattr(val1, 'value', val1)
val2 = getattr(val2, 'value', val2)
self.value = val1 - val2
def __str__(self):
return str(self.value)