JuliaPy / JuliaPy/PyCall.jl

return value of last expression from multi-line py"""..."""

Open
#348 2 comments 2 reactions 0 assignees View on GitHub
enhancement
Dominant language
Julia
Stars
1.5k
Forks
186
PR merge metrics
No merged PRs in 30d

Description

Currenty,
```jl
py"""
....Python code
"""
```
returns nothing, because that is what [`Py_CompileString` does for `Py_file_input`](https://docs.python.org/2/c-api/veryhigh.html).

It would be nice to, instead, return the result of the last expression evaluated, similar to what IPython does when evaluating multi-line input. As discussed in #255, IPython does this by parsing the code and then evaluating one expression in the AST at a time, and in principle we could do the same thing.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing how the py"""...""" input is compiled through Py_CompileString, and read the discussion in #255 alongside IPython's multi-line evaluation behavior. The work is complete when multi-line input returns the result of its last expression rather than nothing, with coverage for that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia, python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.