# Jitclass methods that takes another instance of the same jitclass?

**URL:** <https://numba.discourse.group/t/jitclass-methods-that-takes-another-instance-of-the-same-jitclass/1413>\
**Category:** Support: How do I do ...?\
**Created:** [June 27, 2022, 10:15pm UTC](https://numba.discourse.group/t/jitclass-methods-that-takes-another-instance-of-the-same-jitclass/1413 "2022-06-27T22:15:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lankef](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/lankef/32/646_2.png) [@lankef](https://numba.discourse.group/u/lankef)\
**Post date:** [June 27, 2022, 10:15pm UTC](https://numba.discourse.group/t/jitclass-methods-that-takes-another-instance-of-the-same-jitclass/1413/1 "2022-06-27T22:15:43Z")

</div>

Is it possible to have a jitclass with overloaded operators that takes another jitclass? Something like:

```auto
spec = [
    ('content', complex128[:]), # a simple scalar field
]

@jitclass(spec)
class Container():
    def __init__ (content):
        self.content = content
   @njit(Container(Container, Container))
   def __mul__ (self,other):
       return(Container(np.convolve(self.content, other.content)))

   @njit(Container(Container, complex128))
   def __mul__ (self,other):
       return(Container(self.content * other)

   @njit(Container(Container, Container))
   def __add__ (self,other):
       return(self.content + other.content)
...

```

I need this to loop over code segments generated from very long expressions generated with mathematica that are hard to further reformat:

```auto
a = [list of Containers]
b = [list of Containers]
c = [list of Containers]
result_list = []
for i in prange(100):
    result_list.append(
        a[i]*b[i]*c[i]+0.2*d[i]+a[i]*(i+(a[i]+b[i])*c[i])....
    )

```

Thanks!
