[issue15416] 3 * [] gives a list of 3 cross-referenced lists, a[1]='blah' writes in to ALL three!

2013-01-03 Thread R. David Murray
R. David Murray added the comment: But that's about numpy, which is not part of core Python, and so doesn't belong in a Python FAQ. But perhaps your posting it here will help someone doing an internet search... -- nosy: +r.david.murray ___ Python t

[issue15416] 3 * [] gives a list of 3 cross-referenced lists, a[1]='blah' writes in to ALL three!

2013-01-03 Thread Martin Mokrejs
Martin Mokrejs added the comment: For the sake of internet archives, the following could be included in the FAQ you referred to: http://www.scipy.org/Cookbook/BuildingArrays >>> import numpy as np >>> a=np.array(5*[False],bool) >>> a array([False, False, False, False, False], dtype=bool) >>> a

[issue15416] 3 * [] gives a list of 3 cross-referenced lists, a[1]='blah' writes in to ALL three!

2012-07-21 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: The * operator does not create copies, it duplicates references to existing objects. Please read: http://docs.python.org/faq/programming.html#how-do-i-create-a-multidimensional-list -- nosy: +amaury.forgeotdarc resolution: -> invalid status: op

[issue15416] 3 * [] gives a list of 3 cross-referenced lists, a[1]='blah' writes in to ALL three!

2012-07-21 Thread Martin Mokrejs
Changes by Martin Mokrejs : -- title: 3 * [] gives a list of 3 cross-referenced lists, a[1]='blash -> 3 * [] gives a list of 3 cross-referenced lists, a[1]='blah' writes in to ALL three! ___ Python tracker ___