title: Compare strings in numba-compiled function
body: <p>I'm looking at the best way to compare strings in a python function compiled using numba jit (no python mode, python 3).</p>
  
  <p>The use case is the following :</p>
  
  <pre><code>import numba as nb
  
  @nb.jit(nopython = True, cache = True)
  def foo(a, t = 'default'):
      if t == 'awesome':
          return(a**2)
      elif t == 'default':
          return(a**3)
      else:
          ...
  </code></pre>
  
  <p>However, the following error is returned:</p>
  
  <pre><code>Invalid usage of == with parameters (str, const('awesome'))
  </code></pre>
  
  <p>I tried using bytes but couldn't succeed.</p>
  
  <p>Thanks !</p>
  
  <hr>
  
  <p>Maurice pointed out the question <a href="https://stackoverflow.com/questions/32056337/python-can-numba-work-with-arrays-of-strings-in-nopython-mode">Python: can numba work with arrays of strings in nopython mode?</a> but I'm looking at native python and not the numpy subset supported in numba.</p>