brain stuck. whats occurring here?

Matthew_WARREN at Matthew_WARREN at
Thu Feb 7 18:38:28 CET 2008


I'm after


(NxN 'grid', 5x5 in that example, and while typing this up i figured out
how to get it, but I'm still not sure what _was_ happening)

I'm trying

>>>> a=[]
>>> row=[ [] for n in range(0,10) ]
>>> a.extend(row[:])
>>> a
[[], [], [], [], [], [], [], [], [], []]
>>> a[0].extend(row[:])
>>> a
[[[...], [], [], [], [], [], [], [], [], []], [], [], [], [], [], [], [],
[], []]

why isnt that last a


Puzzled :)


This message and any attachments (the "message") is
intended solely for the addressees and is confidential. 
If you receive this message in error, please delete it and 
immediately notify the sender. Any use not in accord with 
its purpose, any dissemination or disclosure, either whole 
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message. 
BNP PARIBAS (and its subsidiaries) shall (will) not 
therefore be liable for the message if modified. 
Do not print this message unless it is necessary,
consider the environment.


Ce message et toutes les pieces jointes (ci-apres le 
"message") sont etablis a l'intention exclusive de ses 
destinataires et sont confidentiels. Si vous recevez ce 
message par erreur, merci de le detruire et d'en avertir 
immediatement l'expediteur. Toute utilisation de ce 
message non conforme a sa destination, toute diffusion 
ou toute publication, totale ou partielle, est interdite, sauf 
autorisation expresse. L'internet ne permettant pas 
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce 
message, dans l'hypothese ou il aurait ete modifie.
N'imprimez ce message que si necessaire,
pensez a l'environnement.

More information about the Python-list mailing list