Question about Pass-by-object-reference?

fl rxjwg98 at gmail.com
Wed Jul 23 00:17:12 CEST 2014


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. Could you
explain it to me, or where can I find it on line?



More information about the Python-list mailing list