I'm trying to run the following code with numba but get an error:
from numba import jit
@jit(nopython=True)
def create_card_deck():
values = "23456789TJQKA"
suites = "CDHS"
Deck = []
[Deck.append(x + y) for x in values for y in suites]
return Deck
create_card_deck()
Any suggestions what is causing this error are appreciated:
'DataFlowAnalysis' object has no attribute 'op_STORE_DEREF'
There are two problems here - the more fundamental one is that numba
doesn't support strings in nopython
mode
@jit(nopython=True)
def create_card_deck():
values = "23456789TJQKA"
suites = "CDHS"
return values
In [4]: create_card_deck()
---------------------------------------------------------------------------
NotImplementedError : Failed at nopython (nopython mode backend)
cannot convert native str to Python object
That specific error is because list comprehensions are also not currently supported in nopython mode.