Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!ecngs!feeder2.ecngs.de!novso.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'tutorial': 0.03; 'subject:Question': 0.07; '22,': 0.09; 'beginners': 0.09; 'builtin': 0.09; 'explanation': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'def': 0.12; 'already,': 0.16; 'mylist': 0.16; 'notation': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:object': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'example.': 0.24; "haven't": 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; '[1]': 0.29; 'covered': 0.32; 'url:python': 0.33; 'could': 0.34; 'thanks': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'should': 0.36; 'list': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'explain': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'introduced': 0.61; 'full': 0.61; 'url:index': 0.63; 'july': 0.63; 'received:pacbell.net': 0.84; 'shadow': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: emile Subject: Re: Question about Pass-by-object-reference? Date: Tue, 22 Jul 2014 15:33:10 -0700 References: <986eee35-0327-46e5-bce0-b1ae4572dd8f@googlegroups.com> <6d919cfd-5d3e-4081-94a7-80ce64eedd83@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-69-226-129-65.dsl.pltn13.pacbell.net User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: <6d919cfd-5d3e-4081-94a7-80ce64eedd83@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1406068419 news.xs4all.nl 2859 [2001:888:2000:d::a6]:35225 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75037 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 https://docs.python.org/2/tutorial/introduction.html 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. https://docs.python.org/2/tutorial/index.html Emile