# About limitations and mismatch in set of identifiers when using PyJulia

**URL:** <https://discourse.julialang.org/t/about-limitations-and-mismatch-in-set-of-identifiers-when-using-pyjulia/87042>\
**Category:** General Usage\
**Tags:** package, pycall, embedding, python, pyjulia\
**Created:** [September 10, 2022, 4:19pm UTC](https://discourse.julialang.org/t/about-limitations-and-mismatch-in-set-of-identifiers-when-using-pyjulia/87042 "2022-09-10T16:19:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AntoineRestivo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/antoinerestivo/32/36509_2.png) [@AntoineRestivo](https://discourse.julialang.org/u/AntoineRestivo)\
**Post date:** [September 10, 2022, 4:19pm UTC](https://discourse.julialang.org/t/about-limitations-and-mismatch-in-set-of-identifiers-when-using-pyjulia/87042/1 "2022-09-10T16:19:47Z")

</div>

Hi everyone, I am interested to make a package available for python users. I understood that the right tool would be PyJulia. The point is, as I understand it has some limitations about the comprehension of valid identifiers right? Like methods such as `sum!` because of the `!` character which have to be replaced by `sum_b`. But I am curious about the definition of parametric types. I guess we have a similar problem when dealing with the characters `{}` right? Does it exist an alternative to deal with parametric types? Or maybe I am totally misunderstanding the aim of PyJulia?

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [September 10, 2022, 5:20pm UTC](https://discourse.julialang.org/t/about-limitations-and-mismatch-in-set-of-identifiers-when-using-pyjulia/87042/2 "2022-09-10T17:20:47Z")

</div>

> [@AntoineRestivo](#):
>
> I understood that the right tool would be PyJulia.

I have a better experience with PythonCall / JuliaCall. But from the perspective of those questions I think they are the same.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 10, 2022, 5:21pm UTC](https://discourse.julialang.org/t/about-limitations-and-mismatch-in-set-of-identifiers-when-using-pyjulia/87042/3 "2022-09-10T17:21:09Z")

</div>

If you want to instantiate these from Python, I think you probably just need to eval a string, e.g. `ComplexInt = Main.eval("Complex{Int}")`. (Your Python wrapper package could always predefine a few such symbols for commonly used types.)

---

<div class="post-metadata">

**Author:** ![AntoineRestivo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/antoinerestivo/32/36509_2.png) [@AntoineRestivo](https://discourse.julialang.org/u/AntoineRestivo)\
**Post date:** [September 11, 2022, 2:03pm UTC](https://discourse.julialang.org/t/about-limitations-and-mismatch-in-set-of-identifiers-when-using-pyjulia/87042/4 "2022-09-11T14:03:53Z")

</div>

Indeed, unfortunately JuliaCall does not help on that point!

---

<div class="post-metadata">

**Author:** ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Post date:** [September 11, 2022, 2:18pm UTC](https://discourse.julialang.org/t/about-limitations-and-mismatch-in-set-of-identifiers-when-using-pyjulia/87042/5 "2022-09-11T14:18:15Z")

</div>

Yes, with either PyJulia or JuliaCall, you will need to use `Main.eval` (or `Main.seval` in the case of JuliaCall) as stevengj says to access any syntax not made available directly in the library. If you need to pass values, you can create a function and call that, e.g.

```python
curly = Main.eval("(a,b...) -> a{b...}")
ComplexInt = curly(Main.Complex, Main.Int)

```

To access fields whose names are not valid Python identifiers, you can always use `getattr`, such as `getattr(Main, "+")` or `getattr(Main, "push!")`. The `_b` suffix (which JuliaCall has copied) is simply a convenience a very common case.

In JuliaCall, you can access the curly syntax for parametric types via ordinary indexing, just like for parametric type annotations in Python:

```python
from juliacall import Main as jl
jl.Vector[jl.Int] # Vector{Int}
jl.NTuple[3, jl.String] # NTuple{3, String}
```

---

<div class="post-metadata">

**Author:** ![AntoineRestivo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/antoinerestivo/32/36509_2.png) [@AntoineRestivo](https://discourse.julialang.org/u/AntoineRestivo)\
**Post date:** [September 11, 2022, 8:01pm UTC](https://discourse.julialang.org/t/about-limitations-and-mismatch-in-set-of-identifiers-when-using-pyjulia/87042/6 "2022-09-11T20:01:19Z")

</div>

Indeed the `curly`function is quiet convenient! Thanks a lot
