Python類ポインタ操作
545 ワード
In [23]: friends_ids = []
In [24]: followers_ids = []
In [25]: for ids1, ids2 in [[friends_ids, followers_ids]]:
....: ids1 += '1'
....: ids2 += '2'
....:
In [26]: id(ids1)
Out[26]: 55711504
In [27]: id(friends_ids)
Out[27]: 55711504
In [28]: ids1
Out[28]: ['1']
In [29]: friends_ids
Out[29]: ['1']
In [30]: id(ids2)
Out[30]: 55754664
In [31]: id(followers_ids)
Out[31]: 55754664
In [32]: ids2
Out[32]: ['2']
In [33]: followers_ids
Out[33]: ['2']