Skip to content

Commit 3322f53

Browse files
committed
Added support for Min and Max
1 parent ed312ad commit 3322f53

File tree

4 files changed

+384
-367
lines changed

4 files changed

+384
-367
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Beside the actual expression the `ToPython` function also supports two options:
2424
* `NumpyPrefix`, which determines the name under which numpy is imported. The default is
2525
to prefix all numpy call with `np.`, but you can also set `NumpyPrefix` to `"numpy"` to
2626
enforce `numpy.` as a prefix. If you supply an empty string, no prefix is added, which
27-
might be useful if you use the wildcard import `fromm numpy import *`
27+
might be useful if you use the wildcard import `from numpy import *`
2828
* `Copy`, which when enabled copies the formatted expression to the clipboard
2929

3030
Taken together, a simple example call is

ToPython.wl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ PythonForm[a_ + b_] := format["`` + ``", a, b];
7575
PythonForm[Power[a_, b_]] := format["`` ** ``", br[a], br[b]];
7676
PythonForm[Exp[a_]] := format["numpy.exp(``)", a];
7777

78+
(* Some basic functions *)
79+
PythonForm[Max[a_, b_]] := format["numpy.maximum(`1`, `2`)", a, b];
80+
PythonForm[Min[a_, b_]] := format["numpy.minimum(`1`, `2`)", a, b];
81+
7882
(* Some special functions *)
7983
PythonForm[Arg[a_]] := format["numpy.angle(``)", a];
8084
PythonForm[SphericalHarmonicY[l_, m_, a_, b_]] := format[

0 commit comments

Comments
 (0)