# Juliacall access zero-dimensional array with \[\]

**URL:** <https://discourse.julialang.org/t/juliacall-access-zero-dimensional-array-with/100610>\
**Category:** New to Julia\
**Tags:** juliacall\
**Created:** [June 20, 2023, 2:23pm UTC](https://discourse.julialang.org/t/juliacall-access-zero-dimensional-array-with/100610 "2023-06-20T14:23:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vrige\_me](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vrige_me/32/50890_2.png) [@vrige\_me](https://discourse.julialang.org/u/vrige_me)\
**Post date:** [June 20, 2023, 2:23pm UTC](https://discourse.julialang.org/t/juliacall-access-zero-dimensional-array-with/100610/1 "2023-06-20T14:23:26Z")

</div>

Hi! I am new to julia and I am trying to use julia in python because i need some python libraries.  
I have some julia function that i would like to call using juliacall, but I got stuck when `[]` was called on a zero-dimensional array and I don’t know how to do the same with juliacall, because it gives me syntax error.  
Just to be precise: I have a short julia code `f(...)[]` where the function f returns a zero-dimensional array. With juliacall I am calling jl.library\_containg\_the\_function.f(…) and it works, but i don’t know how to use `[]`.  
Furthermore, I would like to not modify anything in the julia library.

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [June 20, 2023, 3:20pm UTC](https://discourse.julialang.org/t/juliacall-access-zero-dimensional-array-with/100610/2 "2023-06-20T15:20:04Z")

</div>

Welcome. Indexing with square brackets is the syntax for calling the [`getindex`](https://docs.julialang.org/en/v1/base/arrays/#Base.getindex-Tuple%7BAbstractArray,%20Vararg%7BAny%7D%7D) function. So you can replace `x[]` with `getindex(x)`, both in Julia itself and in juliacall.

---

<div class="post-metadata">

**Author:** ![vrige\_me](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vrige_me/32/50890_2.png) [@vrige\_me](https://discourse.julialang.org/u/vrige_me)\
**Post date:** [June 22, 2023, 1:36pm UTC](https://discourse.julialang.org/t/juliacall-access-zero-dimensional-array-with/100610/3 "2023-06-22T13:36:15Z")

</div>

Thank you so much for the reply! It solved my problem 🙂

---

<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:** [June 22, 2023, 3:48pm UTC](https://discourse.julialang.org/t/juliacall-access-zero-dimensional-array-with/100610/4 "2023-06-22T15:48:04Z")

</div>

You can also do `x[()]` in Python.

Why? Well `x[a,b,c]` is just shorthand for `x[(a,b,c)]`, i.e. indexing with a single tuple. This means that Python objects supporting “multi-indexing” actually just check if the given index is a tuple. Therefore you can do “empty-indexing” with the empty tuple.
