Steve Holden <[EMAIL PROTECTED]> writes:
> Arnaud Delobelle wrote:
>> Jason Scheirer <[EMAIL PROTECTED]> writes:
>>> Python is pass-by-reference, not pass-by-value.
>>
>> It's certainly not pass-by-reference, nor is it pass-by-value IMHO.
>>
> Since no lists are being passed as arguments in thes
The issue is exhausted in Python Library Reference, Chapter 3.6, so I
should apologize for initial posting. All comments were helpful,
though Arnaud and Steve are right that pass-by-anything is off the
point.
Thanks All!
--
http://mail.python.org/mailman/listinfo/python-list
Arnaud Delobelle wrote:
> Jason Scheirer <[EMAIL PROTECTED]> writes:
>
>> On Nov 24, 10:34 pm, [EMAIL PROTECTED] wrote:
>>> Hi Python experts! Please explain this behavior:
>>>
>> nn=3*[[]]
>> nn
>>> [[], [], []]
>> mm=[[],[],[]]
>> mm
>>> [[], [], []]
>>>
>>> Up till now, 'mm' and
On Tue, Nov 25, 2008 at 9:23 AM, Arnaud Delobelle <[EMAIL PROTECTED]>wrote:
> Jason Scheirer <[EMAIL PROTECTED]> writes:
>
> > On Nov 24, 10:34 pm, [EMAIL PROTECTED] wrote:
> >> Hi Python experts! Please explain this behavior:
> >>
> >> >>> nn=3*[[]]
> >> >>> nn
> >> [[], [], []]
> >> >>> mm=[[],[
Jason Scheirer <[EMAIL PROTECTED]> writes:
> On Nov 24, 10:34 pm, [EMAIL PROTECTED] wrote:
>> Hi Python experts! Please explain this behavior:
>>
>> >>> nn=3*[[]]
>> >>> nn
>> [[], [], []]
>> >>> mm=[[],[],[]]
>> >>> mm
>>
>> [[], [], []]
>>
>> Up till now, 'mm' and 'nn' look the same, right? Nope
On Nov 24, 10:34 pm, [EMAIL PROTECTED] wrote:
> Hi Python experts! Please explain this behavior:
>
> >>> nn=3*[[]]
> >>> nn
> [[], [], []]
> >>> mm=[[],[],[]]
> >>> mm
>
> [[], [], []]
>
> Up till now, 'mm' and 'nn' look the same, right? Nope!
>
> >>> mm[1].append(17)
> >>> mm
> [[], [17], []]
> >>
[EMAIL PROTECTED] wrote:
> Hi Python experts! Please explain this behavior:
>
[] make an empty list.
[ [],[],[] ] makes a list of three different empty lists.
3*[[]] makes a list of three references to the same list.
Realy, that should explain it all, but perhaps there are enough empty
lists