Problem with assigning variables of type List

Peter Hansen peter at engcorp.com
Thu Aug 22 08:27:49 EDT 2002


Duncan Booth wrote:
> 
> Peter Hansen <peter at engcorp.com> wrote:
[snip Peter's explanation]
> 
> How does this fit with your explanation?
> 
> >>> a = [1, 2, 3]
> >>> b = [1, a, 3]
> >>> b
> [1, [1, 2, 3], 3]
> >>> a
> [1, 2, 3]
> >>> a[1] = b
> >>> a
> [1, [1, [...], 3], 3]
> >>> b
> [1, [1, [...], 3], 3]
> >>> a==b
> 1

Uh, it doesn't?  :-)  Maybe see Michael's response instead...

-Peter



More information about the Python-list mailing list