diff options
| author | yo mama <pepper@scannerjammer.com> | 2015-09-21 14:20:13 -0700 |
|---|---|---|
| committer | yo mama <pepper@scannerjammer.com> | 2015-09-21 14:20:13 -0700 |
| commit | b29b0ec5f11dd66434cbdfba5287c4777d7f8ac9 (patch) | |
| tree | f02f45661bdab855d8392e14ba6448546586bf37 /lib/Param/Float/__init__.py | |
| parent | 8f2230b7c866320e3839d6812b98b8370a7ec5d9 (diff) | |
new file structure
Diffstat (limited to 'lib/Param/Float/__init__.py')
| -rw-r--r-- | lib/Param/Float/__init__.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Param/Float/__init__.py b/lib/Param/Float/__init__.py new file mode 100644 index 0000000..0581815 --- /dev/null +++ b/lib/Param/Float/__init__.py @@ -0,0 +1,19 @@ +from Param import Param + +class ParamFloat(Param): + def __init__(self, value, classname=""): + self._classname = classname + super(ParamFloat, self).__init__(classname=classname) + try: + if value: + self.value = float(value) + else: + self.value = 0.0 + except Exception as e: + self.err_warn("Not a float: %s" % str(value)) + self.err_warn(str(e)) + def __int__(self): + return int(self.value) + + def __float__(self): + return float(self.value) |
