diff options
| author | yo mama <pepper@scannerjammer.com> | 2015-09-23 23:27:27 -0700 |
|---|---|---|
| committer | yo mama <pepper@scannerjammer.com> | 2015-09-23 23:27:27 -0700 |
| commit | 5c982ed500b51f5b8d911e5a5adec10ac2d31d2e (patch) | |
| tree | efca7a0f0209d25972df00173e4c92a814956a7a /lib/Param/Int.py | |
| parent | 2755b029d873f93d91086b3d69a4c57d05c40fb5 (diff) | |
ok good
Diffstat (limited to 'lib/Param/Int.py')
| -rw-r--r-- | lib/Param/Int.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Param/Int.py b/lib/Param/Int.py new file mode 100644 index 0000000..0a73cc1 --- /dev/null +++ b/lib/Param/Int.py @@ -0,0 +1,18 @@ +from Param import Param + +class ParamInt(Param): + def __init__(self, value, classname=""): + super(ParamInt, self).__init__(classname=classname) + try: + if value: + self.value = int(value) + else: + self.value = 0 + except Exception as e: + self.err_warn("Not an int: %s" % str(value)) + self.err_warn(str(e)) + def __int__(self): + return int(self.value) + + def __float__(self): + return float(self.value) |
