On 6/8/06, Jacob Fugal <lukfugl / gmail.com> wrote:
> On 6/8/06, Marcel Molina Jr. <marcel / vernix.org> wrote:
> > On Fri, Jun 09, 2006 at 02:54:32AM +0900, Todd Breiholz wrote:
> > > Is there any difference between the following:
> > >
> > > a = ['a','b','c','d','e']
> > > z = ['x','y','z']
> > > a.replace(z)
> >
> > a.object_id == z.object_id
> > # => false
> >
> > > and
> > >
> > > a = ['a','b','c','d','e']
> > > z = ['x','y','z']
> > > a = z
> >
> > a.object_id == z.object_id
> > # => true
>
> Also:
>
>   a = ['a','b','c','d','e']
>   b = a
>   z = ['x','y','z']
>   a.replace(z)
>   p b # => ['x', 'y', 'z']
>
> vs.
>
>   a = ['a','b','c','d','e']
>   b = a
>   z = ['x','y','z']
>   a = z
>   p b # => ['a', 'b', 'c', 'd', 'e']
>
> Jacob Fugal
>
>

OK. I get it. When I use the assignment, a becomes (points to the same
object as) z. Using replace, both maintain their individuality.

Thanks for the clarification.

Todd