Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Py.python and Py.expr_python #3482

Closed
MangelMaxime opened this issue Jun 28, 2023 · 2 comments · Fixed by #3551
Closed

Remove Py.python and Py.expr_python #3482

MangelMaxime opened this issue Jun 28, 2023 · 2 comments · Fixed by #3551
Labels
python Python

Comments

@MangelMaxime
Copy link
Member

Description

There are emitStatement and emitExpr which cover the same feature with the bonus of accepting argument so the user can use $0, $1, etc. to access them in the expression.

@MangelMaxime MangelMaxime added the python Python label Jun 28, 2023
@dbrattli dbrattli reopened this Oct 18, 2023
@dbrattli
Copy link
Collaborator

I don't think emitStatement does the same thing as python. The python one supports string interpolation to handle arguments e.g:

let add a b = Py.python $"""
    return {a+b}
    """

This produces:

def add(a: int, b: int) -> Any:
    
    return (a + b)

@dbrattli
Copy link
Collaborator

The JS equivalent was not removed so I think we should add this back: https://github.com/fable-compiler/Fable/blob/main/src/Fable.Core/Fable.Core.JS.fs#L547

Better naming would be nice, but there are some magic happening to get syntax highlighting in vscode for the contained code https://github.com/alfonsogarciacaro/vscode-template-fsharp-highlight

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Python
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants