Skip to content

Commit f1261ab

Browse files
committed
Fixes for print function
- Add ipython display
1 parent b3be2f0 commit f1261ab

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

examples/microbit/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ very limited what we can do. Parts of Fable Library needs to
77
be ported to work with MicroPython see `util.fs` as an example.
88

99
The micro:bit have a flat file-system so all files needs to be in the
10-
same top-level directory.
10+
same top-level directory. For more information see
11+
https://microbit-micropython.readthedocs.io/en/latest/tutorials/storage.html
1112

1213
## Install Dependecies
1314

src/jupyter/IPython.fs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,12 @@ module Fable.Python.IPython
22

33
open Fable.Core
44

5-
[<Import("display", "IPython.display")>]
6-
let display<'T>(obj: 'T) : unit = nativeOnly
5+
type IDisplay =
6+
abstract display : value: obj -> unit
7+
abstract Code : data: string -> unit
8+
[<Emit("display.Code($1, language=$2)")>]
9+
abstract Code : data: string * language: string -> unit
10+
11+
[<Import("display", "IPython")>]
12+
let display : IDisplay = nativeOnly
13+

src/stdlib/Builtins.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,4 @@ let builtins: IExports = nativeOnly
138138
let __name__: string = nativeOnly
139139

140140
/// Python print function. Takes a single argument, so can be used with e.g string interpolation.
141-
let print = builtins.print
141+
let print obj = builtins.print obj

0 commit comments

Comments
 (0)