# Checking type of object inside a function of a jit class

**URL:** <https://numba.discourse.group/t/checking-type-of-object-inside-a-function-of-a-jit-class/897>\
**Category:** Support: How do I do ...?\
**Created:** [September 5, 2021, 11:03am UTC](https://numba.discourse.group/t/checking-type-of-object-inside-a-function-of-a-jit-class/897 "2021-09-05T11:03:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Filco306](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/filco306/32/387_2.png) [@Filco306](https://numba.discourse.group/u/Filco306)\
**Post date:** [September 5, 2021, 11:03am UTC](https://numba.discourse.group/t/checking-type-of-object-inside-a-function-of-a-jit-class/897/1 "2021-09-05T11:03:14Z")

</div>

Hello,

I am trying to write a **setitem** function for a numba-compiled jitclass. I want it to accept both slices and integers, but in order for it to do that, I need to check the type and see whether it is an integer or a slice. This however raises an error.

```auto
import numba

.
.
.

def __setitem__ (self, idx, value):
        # print(idx)
        
        t = numba.typeof(idx)
        print(t)

        start = idx.start
        stop = idx.stop
        step = idx.step
        print(start)
        print(stop)
        print(step)
        print("hello")

s_m = Class()
s_m[3:10] = 1

```

This gives me the error:

```auto
Failed in nopython mode pipeline (step: nopython frontend)
Unknown attribute 'typeof' of type Module(<module 'numba'

```

---

<div class="post-metadata">

**Author:** ![nelson2005](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/nelson2005/32/47_2.png) [@nelson2005](https://numba.discourse.group/u/nelson2005)\
**Post date:** [September 5, 2021, 5:21pm UTC](https://numba.discourse.group/t/checking-type-of-object-inside-a-function-of-a-jit-class/897/2 "2021-09-05T17:21:19Z")

</div>

Does your function need to be called from a jitted function?

If not, consider structref. You can have non-jitted member functions with that, where regular python bits work.
