FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonmonkey-examples/function-passing-eval.py at main · Distributive-Network/pythonmonkey-examples · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
Distributive-Network
/
pythonmonkey-examples
Public
Notifications
You must be signed in to change notification settings
Fork
3
Star
11
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
pythonmonkey-examples
/
function-passing-eval.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
12 lines (10 loc) · 413 Bytes
Breadcrumbs
pythonmonkey-examples
/
function-passing-eval.py
Copy path
File metadata and controls
executable file
·
12 lines (10 loc) · 413 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/env python3
"""
This example demonstrates passing functions as arguments. Here, a
function is defined in JavaScript which expects a function as an
argument. Then that JavaScript function is executed from Python and
the Python `print` function is passed as an argument.
"""
import
pythonmonkey
as
pm
hello
=
pm
.
eval
(
"(func) => { func('Hello, World!'); }"
)
hello
(
print
)
# this outputs "Hello, World!"
Back
|
FazBrowse Home
|
New Git URL