# typed.List(Tuple(..)) inside njitted func does not compile

**URL:** <https://numba.discourse.group/t/typed-list-tuple-inside-njitted-func-does-not-compile/960>\
**Category:** Community Support\
**Created:** [October 15, 2021, 8:22am UTC](https://numba.discourse.group/t/typed-list-tuple-inside-njitted-func-does-not-compile/960 "2021-10-15T08:22:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zxweed](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/zxweed/32/426_2.png) [@zxweed](https://numba.discourse.group/u/zxweed)\
**Post date:** [October 15, 2021, 8:22am UTC](https://numba.discourse.group/t/typed-list-tuple-inside-njitted-func-does-not-compile/960/1 "2021-10-15T08:22:15Z")

</div>

Hello. I need to create the temporary typed List with items of Tuple type:

```auto
L = List.empty_list(Tuple((int64, float64)))
L.append((1, 3.14))

```

This sample works in the python code, but not in the njitted-func:

```auto
@njit
def Test():
    L = List.empty_list(Tuple((int64, float64)))
    L.append((1, 3.14))
    return L[0]

```

TypingError: Failed in nopython mode pipeline (step: nopython frontend)  
Untyped global name ‘Tuple’: Cannot determine Numba type of \<class ‘numba.core.types.abstract.\_TypeMetaclass’\>

How can I make it work?

---

<div class="post-metadata">

**Author:** ![luk-f-a](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/luk-f-a/32/56_2.png) [@luk-f-a](https://numba.discourse.group/u/luk-f-a)\
**Post date:** [October 15, 2021, 5:54pm UTC](https://numba.discourse.group/t/typed-list-tuple-inside-njitted-func-does-not-compile/960/2 "2021-10-15T17:54:06Z")

</div>

hi @zxweed , I think the problem lies in `Tuple`. Maybe try something like `tup_type = Tuple((int64, float64))` outside the jitted function and then `L = List.empty_list(tup_type)` inside.

Hope this helps,  
Luk

---

<div class="post-metadata">

**Author:** ![zxweed](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/zxweed/32/426_2.png) [@zxweed](https://numba.discourse.group/u/zxweed)\
**Post date:** [October 16, 2021, 7:42am UTC](https://numba.discourse.group/t/typed-list-tuple-inside-njitted-func-does-not-compile/960/3 "2021-10-16T07:42:32Z")

</div>

Thanks, @luk-f-a, this solution works.

---

<div class="post-metadata">

**Author:** ![luk-f-a](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/luk-f-a/32/56_2.png) [@luk-f-a](https://numba.discourse.group/u/luk-f-a)\
**Post date:** [October 16, 2021, 10:13am UTC](https://numba.discourse.group/t/typed-list-tuple-inside-njitted-func-does-not-compile/960/4 "2021-10-16T10:13:15Z")

</div>

@zxweed , since numba has type inference I could also do

```auto
@njit
def Test():
    L = []
    L.append((1, 3.14))
    return L[0]

```

---

<div class="post-metadata">

**Author:** ![zxweed](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/zxweed/32/426_2.png) [@zxweed](https://numba.discourse.group/u/zxweed)\
**Post date:** [October 16, 2021, 12:21pm UTC](https://numba.discourse.group/t/typed-list-tuple-inside-njitted-func-does-not-compile/960/5 "2021-10-16T12:21:50Z")

</div>

@luk-f-a yes, but the numba developers have already announced that this method is considered [deprecated](https://numba.pydata.org/numba-doc/latest/reference/deprecation.html)

---

<div class="post-metadata">

**Author:** ![luk-f-a](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/luk-f-a/32/56_2.png) [@luk-f-a](https://numba.discourse.group/u/luk-f-a)\
**Post date:** [October 16, 2021, 5:39pm UTC](https://numba.discourse.group/t/typed-list-tuple-inside-njitted-func-does-not-compile/960/6 "2021-10-16T17:39:47Z")

</div>

I think what’s deprecated is passing a python list as an input argument, not creating it inside the function. At least, that’s what I read from the description and the fact that running this code does not issue a deprecation warning.
