what does 'a=b=c=[]' do



Is it true that if I want to create an array or arbitrary size such
as:
for a in range(n):
x.append(<some function...>)

I must do this instead?
x=[]
for a in range(n):
x.append(<some function...>)

Now to my actual question. I need to do the above for multiple arrays
(all the same, arbitrary size). So I do this:
x=y=z=[]
for a in range(n):
x.append(<some function...>)
y.append(<some other function...>)
z.append(<yet another function...>)

Except it seems that I didn't create three different arrays, I created
one array that goes by three different names (i.e. x[], y[] and z[]
all reference the same pile of numbers, no idea which pile).

This surprises me, can someone tell me why it shouldn't? I figure if
I want to create and initialize three scalars the just do "a=b=c=7",
for example, so why not extend it to arrays. Also, is there a more
pythonic way to do "x=[], y=[], z=[]"?

It's a slick language but I still have trouble wrapping my brain
around some of the concepts.

TIA,
eric
.



Relevant Pages

  • Re: Whats wrong ?
    ... - to save arrays of S into a pile ... and then to display each S.s (the only data member of S) wich is a string ... //push is a member function that insert the argument void* address at the topof the pile ...
    (microsoft.public.vc.language)
  • Re: array problem
    ... yes is undfined, but why, its because the index is a string? ... with the arrays. ... I' m working on that for 3 days and my brain smoke's. ... Javascript Best Practices - ...
    (microsoft.public.scripting.jscript)
  • Re: array problem
    ... with the arrays. ... I' m working on that for 3 days and my brain smoke's. ... Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/ ...
    (microsoft.public.scripting.jscript)
  • Re: pointer and array
    ... "Brain and Denis"? ... arrays "decay" into pointers in a value context. ...
    (comp.lang.c)
  • Re: Hello Group
    ... understand PHP until you start talking functions and arrays. ... hard to keep it all straight. ... I have a designer's brain trying to ...
    (comp.lang.php)