handle floats along with ints and strings in default arguments; thx Jungle
authorAlexander Solovyov <piranha@piranha.org.ua>
Tue, 06 Apr 2010 16:08:33 +0300
changeset 112 d9d45a5aa73f
parent 111 e40251bf5a23
child 113 92b0f289e7cd
handle floats along with ints and strings in default arguments; thx Jungle
opster.py
--- a/opster.py	Tue Apr 06 16:02:08 2010 +0300
+++ b/opster.py	Tue Apr 06 16:08:33 2010 +0300
@@ -316,14 +316,12 @@
         if t is types.FunctionType:
             del funlist[funlist.index(name)]
             state[name] = defmap[name](val)
-        elif t is types.IntType:
-            state[name] = int(val)
-        elif t is types.StringType:
-            state[name] = val
         elif t is types.ListType:
             state[name].append(val)
         elif t in (types.NoneType, types.BooleanType):
             state[name] = not defmap[name]
+        else:
+            state[name] = t(val)
 
     for name in funlist:
         state[name] = defmap[name](None)