Skip to content

Commit

Permalink
Update python.md
Browse files Browse the repository at this point in the history
  • Loading branch information
david-broman authored Nov 25, 2023
1 parent 6d92a4f commit 368c6e6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/reference/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ To install for the current user, run `make install` as usual.
The following example shows how to use the intrinsics to sort a sequence using
Python's builtin `sorted` function.

```ocaml
```mc
let builtins = pyimport "builtins"
let x = [5.,4.5,4.,1.,1.5]
Expand All @@ -57,7 +57,7 @@ or converted back to an MCore sequence using the `pyconvert` builtin.
instead of a module as the first argument. For example, the following code
will invoke the `count` method of a list:

```ocaml
```mc
let builtins = pyimport "builtins"
let pylist = pycall builtins "list" ([1,1,2],)
Expand All @@ -73,7 +73,7 @@ The following example shows how a numpy `nparray` can be created and converted
to an MCore sequence. The key here is to use numpy's `tolist` method first,
since conversion directly from `nparray` is not supported.

```ocaml
```mc
let rnd = pyimport "numpy.random"
let nparray = pycall rnd "normal" (0., 0.1, 10)
Expand All @@ -83,7 +83,7 @@ let mc_seq = pyconvert (pycall nparray "tolist" ())
In the next example, we use `matplotlib` to produce a plot; this works in
exactly the same way as in a regular Python program.

```ocaml
```mc
let plt = pyimport "matplotlib.pyplot"
let np = pyimport "numpy"
Expand Down

0 comments on commit 368c6e6

Please sign in to comment.