Question about Pass-by-object-reference?

Joel Goldstick joel.goldstick at gmail.com
Tue Jul 22 18:26:58 EDT 2014


it copies the list


On Tue, Jul 22, 2014 at 6:17 PM, fl <rxjwg98 at gmail.com> 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.
> Could you
> explain it to me, or where can I find it on line?
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Joel Goldstick
http://joelgoldstick.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140722/7301c851/attachment.html>


More information about the Python-list mailing list