-
Notifications
You must be signed in to change notification settings - Fork 311
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
Inconsistency in Python import #3481
Comments
let hi : unit -> unit = import "*" "./hello.py"
hi() generates from typing import Callable
import ./hello.py as hello
hi: Callable[[], None] = hello
hi() which is an invalid code. let say_hello : unit -> unit = importAll "hello"
say_hello() generates import hello
from typing import Callable
say_hello: Callable[[], None] = hello
say_hello() I think it should generates from hello import *
from typing import Callable
say_hello() or from hello import *
from typing import Callable
say_hello_1: Callable[[], None] = say_hello
say_hello_1() if we need the variable assignement. |
There's also an issue with |
Should be fixed by #4035 Not sure if |
Hello @dbrattli,
I am writing the documentation for Python on Fable website and found some strange behaviour.
I don't know if they are bugs or expected, as I am not a python expert.
I have a
hello.py
file with this content:Generates
So it means that it is stripping the
./
and.py
from the path. However, using a relative path for*
doesn't strip anythinggenerates
The same kind of problem occurs when trying to use:
[<ImportAll("./hello.py")>]
[<ImportDefault("./hello.py")>]
generates
I would have expected the generated code to be
generates
Should it be ?
generates
Should it strip the path?
Also, generated code doesn't work because it tries to execute the module instead of
hello.say_hello()
generates
The code will fail at runtime, but I don't know what is the expected output here.
but
generates
Is it normal to have a difference here? And the code will fails to, but I don't know what is the expected output here.
Related information
The text was updated successfully, but these errors were encountered: