Commits

Jesús Gómez committed 01b923a

Python version

  • Participants
  • Parent commits 59d0fb4

Comments (0)

Files changed (2)

 
 class Mwfaui {
     
-    // Reflection doesn't understand Generic Methods
+
     public double f(double x)
     {
 	return x;
     }
 
-    // in the case of multiplication and division there are no
-    // built-in interfaces that generalize over numeric types for i
     public double f2(double x)
     {
 	return x*x;
+def f(x):
+    return x
+
+def f2(x):
+    return x*x
+
+def f12(x):
+    return x/2
+
+def main():
+    import sys
+    fun = sys.argv[1]
+    x = float(sys.argv[2])
+
+    mapfun = {'f':f, 'f2':f2, 'f12':f12}
+
+    print(mapfun[fun](x))
+
+if __name__ == "__main__": main()