Question about Pass-by-object-reference?

emile emile at
Wed Jul 23 00:33:10 CEST 2014

On 07/22/2014 03:17 PM, fl wrote:
> On Tuesday, July 22, 2014 4:46:25 PM UTC-4, emile wrote:
>> On 07/22/2014 01:35 PM, Peter Pearson wrote:
>> def reassign(mylist):  # no reason to shadow the list builtin
>>       mylist[:] = [0,1]
>> mylist = [1]
>> reassign(mylist)
>> mylist
>> Emile
> Thanks for your example. I do not find the explanation of [:] on line.

It's covered in the tutorial in

look for the section on slice notation

> Could you explain it to me, or where can I find it on line?

If you haven't already, you should work your way through the full 
tutorial if for no other reason that to be familiar with content others 
find beginners should be introduced to.


More information about the Python-list mailing list