Daily Archives: July 29, 2013

Python: list of empty lists creates references not copy

In Python, you can create a list with an element repeated N times quite easily with the following syntax: >>> a = [1] * 5 >>> print(a) [1,1,1,1,1] >>> a = [1] * 5 >>> print(a) [1,1,1,1,1] Here we create … Continue reading

Posted in Python | Tagged | Leave a comment