Skip to content
This repository has been archived by the owner on Jan 9, 2019. It is now read-only.

Commit

Permalink
Simplify example
Browse files Browse the repository at this point in the history
  • Loading branch information
mdboom committed Jun 13, 2018
1 parent 4192765 commit c3f0094
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions python.html
Expand Up @@ -118,9 +118,7 @@

%% code {"language":"py"}
# python
def square(x, integer=False):
if integer:
x = int(x)
def square(x):
return x * x

%% md
Expand All @@ -129,14 +127,14 @@
%% js
// javascript
var square = pyodide.pyimport("square")
square([2.5], {integer: true})
square(2.5)

%% md
This is equivalent to the following Python syntax:

%% code {"language":"py"}
# python
square(2.5, integer=True)
square(2.5)

%% md
You can also get the attributes of objects in a similar way. Say we had an instance of the following Python custom class:
Expand Down

0 comments on commit c3f0094

Please sign in to comment.