-
Notifications
You must be signed in to change notification settings - Fork 78
Closed
Description
with
import juliacall
import Main from juliacall as jlThe following all return false.
I expected them all to return True
jl.String("a") == juliacall.convert(jl.String, "a")
"a" == juliacall.convert(jl.String, "a")
juliacall.convert(jl.String, "a") == jl.String("a")The following do return true:
jl.String("a") == jl.String("a")
juliacall.convert(jl.String, "a") == juliacall.convert(jl.String, "a")
"a" == jl.String("a")I think what is going wrong is that juliacall.convert wraps the string in an AnyValue even though it doesn't have to.
Where is jl.String actually doesn't:
In : type(juliacall.convert(jl.String, "a"))
Out: juliacall.AnyValue
In : type(jl.String("a"))
Out: str
And AnyValue does not overload equality.
In contrast other similar types return wrapper types that do.
In : type(juliacall.convert(jl.Float64, 1.5))
Out: juliacall.RealValue
In : juliacall.convert(jl.Float64, 1.5) == 1.5
Out: True
In : type(juliacall.convert(jl.Bool, True))
Out: juliacall.IntegerValue
In : juliacall.convert(jl.Bool, True) == True
Out: True
Metadata
Metadata
Assignees
Labels
No labels