Преглед изворни кода

Added shortcut functions for logarithmic operator nodes.

Taddeus Kroes пре 14 година
родитељ
комит
dd613cc34c
1 измењених фајлова са 14 додато и 0 уклоњено
  1. 14 0
      src/rules/logarithmic.py

+ 14 - 0
src/rules/logarithmic.py

@@ -0,0 +1,14 @@
+from ..node import ExpressionNode as N, ExpressionLeaf as L, OP_LOG, OP_LN
+from ..possibilities import Possibility as P, MESSAGES
+from ..translate import _
+
+
+def log(exponent, base=10):
+    if not isinstance(base, L):
+        base = L(base)
+
+    return N('log', exponent, base)
+
+
+def ln(exponent):
+    return N('ln', exponent)