Package lepl :: Package core :: Module dynamic
[hide private]
[frames] | no frames]

Source Code for Module lepl.core.dynamic

 1   
 2   
3 -class BaseVar(object):
4
5 - def __init__(self, value=None):
6 if value is not None: value = self._cast(value) 7 self.value = value
8
9 - def _cast(self, value):
10 return value
11
12 - def setter(self):
13 def wrapper(results): 14 self.value = self._cast(results[0]) 15 return results
16 return wrapper
17
18 - def __lt__(self, other):
19 return self.value < other
20
21 - def __le__(self, other):
22 return self.value <= other
23
24 - def __gt__(self, other):
25 return self.value > other
26
27 - def __ge__(self, other):
28 return self.value >= other
29
30 - def __eq__(self, other):
31 return self.value == other
32
33 - def __hash__(self):
34 return hash(self.value)
35 36
37 -class IntVar(BaseVar):
38
39 - def _cast(self, value):
40 return int(value)
41
42 - def __int__(self):
43 return self.value
44