# How to control type conversion from python to julia

**URL:** <https://discourse.julialang.org/t/how-to-control-type-conversion-from-python-to-julia/81840>\
**Category:** New to Julia\
**Created:** [May 28, 2022, 6:19pm UTC](https://discourse.julialang.org/t/how-to-control-type-conversion-from-python-to-julia/81840 "2022-05-28T18:19:20Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [May 28, 2022, 7:45pm UTC](https://discourse.julialang.org/t/how-to-control-type-conversion-from-python-to-julia/81840/2 "2022-05-28T19:45:53Z")

</div>

Hi, welcome to the Julia community! If you haven’t already, it’s worth reading [this](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757).

I assume you’re using [pyjulia](https://pypi.org/project/julia/)? If so then yes, it does try to convert nested lists to higher dimensional arrays if the lengths agree - which is annoying if you have lists of lists that just happen to agree in length sometimes.

One workaround I think is to use a tuple of lists instead of a list of lists.

I think it’s also possible to wrap a Julia function in a way that calling it from Python doesn’t try to convert the arguments, so that you can convert them yourself, but I don’t remember how.

Alternatively you could try out [juliacall](https://pypi.org/project/juliacall/), which is more conservative in converting data between Julia and Python.

Or if you’re just trying to accelerate one bit of a large Python program, maybe [numba](https://pypi.org/project/numba/) or [cython](https://pypi.org/project/Cython/) are a better alternative than embedding Julia.

---

_[View the full topic](https://discourse.julialang.org/t/how-to-control-type-conversion-from-python-to-julia/81840)._
