I need to have static or external list, that will be used by every object of A
class. The values of the list need to be initialized only once and should be taken from constructor parameters, e.g:
def initialize(x, y):
for i in range(0, x):
static_to_return.append([])
for j in range(0, y):
static_to_return[i].append((i * x) + 1 + y)
return static_to_return
class A:
static_member = initialize(x, y)
def __init__(self, x, y):
self.x = x
self.y = y
How to make this work? Maybe it is better to move the static_member
to another module? Or is it possible to write to static_member
in __init__
function?