How to call inplace (! convention) functions with JuliaCall?

Hello!

I’m trying to wrap a Julia package in Python using JuliaCall.jl. I have many functions in Julia that have both an in place version f!, and a corresponding out of place f. Unfortunately, one cannot have ! in as part of the name of a Python function, so that I cannot call jl.f! in Python. Is there a workaround?

Thanks in advance!

! at the end of a function isn’t syntax, it’s convention. If you want to call it from python, give it another name.

Yes, I meant convention, sorry for the misunderstanding. I’m actually trying to wrap a Julia package that I wrote and which contains lots of functions with both f and f! versions. I could release a new version of the package adding f_ip = f! for all of them, but it seems very cumbersome. Would there be a better way?

I also edited the original post to make question clearer.

You can do jl.f_b - the trailing _b (B for bang) is converted to ! for you.

Or less magically you can do getattr(jl, "f!").

4 Likes