我想知道是否有可能預先填充arraylist插槽?例如,可以通過如下賦值操作來填寫st數組: student [] st = new student[3];
st[0] = new student("214365879","eric banner", 67);
st[1] = new student("988634321","tony park",45);
st[2] = new s
說我有一個類定義__slots__: class Foo(object):
__slots__ = ['x']
def __init__(self, x=1):
self.x = x
# will the following work?
def __setattr__(self, key, value):
if key == 'x