summaryrefslogtreecommitdiff
path: root/lib/param/int_.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/param/int_.py')
-rw-r--r--lib/param/int_.py18
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..fd9730d
--- /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)