Skip to content

Commit d7d6a3a

Browse files
committed
Throw message when a derivative is contained in the code
1 parent fe6421c commit d7d6a3a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ToPython.wl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ PythonForm[Times[-1, a_]] := format["-``", br[a]];
5959
PythonForm[Power[a_, Rational[1, 2]]] := format["numpy.sqrt(``)", a];
6060
PythonForm[Times[a_, Power[b_, -1]]] := format["`` / ``", br[a], br[b]];
6161

62+
(* special forms that are not supported *)
63+
ToPython::hasDerivative="Dervatives are not supported";
64+
PythonForm[Derivative[___]] := (Message[ToPython::hasDerivative]; Abort[]);
65+
6266
(* Simple math *)
6367
PythonForm[Rational[a_, b_]] := format["`` / ``", br[a], br[b]];
6468
PythonForm[Complex[a_, b_]] := format["complex(``, ``)", a, b];

0 commit comments

Comments
 (0)