I am trying to generate a pascal triangle table in python3. I started to like using this following pattern when dealing with 2D arrays.Generate a list of valid indicesUse a function that work with those indices in a list comprehension. (may produce side effects)I wonder, is this pattern pythonic and how common is it in practice?def pascal_triangle(level):    def compute(table, row, col):        if row == 0:            table.append([])        if col == 0 or row == col:            table[row].append(1)        elif col <= row:            table[row].append(table[row-1][col] + table[row-1][col-1])    table = []    valid_idxs = [(r,c) for r in range(level) for c in range(level)]    [compute(table, r, c) for r, c in valid_idxs]     print(table)
Is it pythonic to create side effect inside list comprehension?
python