try:
fact_func = math.factorial
except AttributeError:
- def fact_func(num):
- return num * fact_func(num - 1)
-factorial = operation.generate_function(math.factorial, "!", operation.Function.REP_POSTFIX, 1)
+ def fact_func(self, num):
+ if num <= 0:
+ return 1
+ return num * fact_func(self, num - 1)
+factorial = operation.generate_function(fact_func, "!", operation.Function.REP_POSTFIX, 1)
negate = operation.generate_function(operator.neg, "+-", operation.Function.REP_PREFIX, 1)
square = operation.generate_function((lambda self, x: x ** 2), "sq", operation.Function.REP_FUNCTION, 1)
square_root = operation.generate_function((lambda self, x: x ** 0.5), "sqrt", operation.Function.REP_FUNCTION, 1)
__author__ = "Ed Page"
__email__ = "eopage@byu.net"
__version__ = "0.9.3"
-__build__ = 0
+__build__ = 1
__changelog__ = '''
0.9.3 - ""
* Added +/-, !, sq, and sqrt functions