I want to assign empty list to multiple variables. I have tried these:
# method 1
a = b = []
# method 2
c, d = [], []
print('\nBefore')
print(f'a: id={id(a)} value={a}')
print(f'b: id={id(b)} value={b}')
print(f'c: id={id(c)} value={c}')
print(f'd: id={id(d)} value={d}')
b = [1,2,5]
c = [6,4,2]
print('\nAfter')
print(f'a: id={id(a)} value={a}')
print(f'b: id={id(b)} value={b}')
print(f'c: id={id(c)} value={c}')
print(f'd: id={id(d)} value={d}')
The difference, that I can see, is that both a and b point to the same location at initialize but changes after assignments. What is the Pythonic way to assign empty list to multiple variables?
Edit: Question is not about how to assign multiple variables but what is the Pythonic way(better way) of assigning multiple variables.