Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: What is a function parameter =[] for? Date: Fri, 20 Nov 2015 06:09:49 +1100 Lines: 23 Message-ID: References: <564dbe6b$0$1610$c3e8da3$5496439d@news.astraweb.com> <564df258$0$1604$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de WIUDmWD65W777x9jjRC3VQL8ojauK/TAxP1zb2Kxt/1g== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:209.85.223': 0.03; 'correct.': 0.07; 'expressions': 0.07; 'objects,': 0.07; 'cc:addr:python-list': 0.09; 'python': 0.10; '"="': 0.16; 'expression.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:209.85.223.173': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'shallow': 0.16; 'wrote:': 0.16; 'copied': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'exceptions': 0.22; 'object.': 0.22; 'am,': 0.23; "python's": 0.23; 'header:In-Reply-To:1': 0.24; 'points': 0.27; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'about.': 0.29; 'referencing': 0.29; 'raise': 0.29; "i'm": 0.30; 'becomes': 0.30; 'probably': 0.31; 'received:google.com': 0.35; 'nov': 0.35; 'something': 0.35; 'but': 0.36; 'received:209.85': 0.36; '(and': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'copying': 0.38; 'why': 0.39; 'does': 0.39; 'some': 0.40; 'back': 0.62; '20,': 0.66; 'stated': 0.70; 'evaluate': 0.72; 'chrisa': 0.84; 'wrong!': 0.84; 'to:none': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=utg16YB+K1tQw8mWgE8cKAm7PYUNpI9hpqU1ePPt8/o=; b=0jvQXEVuUs1hlp88CAbc7OS35OEFiP6uFwFmgFJ4U49f2hT2LUXCBJNSwjKdu4PdJL aSlPmH+aNOAtm66SzsZgmWeiLh2aHmtJnLE0ORZrmpMxwvQIome7GHi4icudYqZqzuO8 JgWDz8RmZMw3gLyZ6JqJKhdOwXEdtmB7oeKLFUuaZb7gBteomHFAgpj6jFI7V+VLYl17 d3P4YD17q1DVjGuGcqqR5XW1hwxfkTLDfsRzr5VwWsV3tJVWai5gbkIo1TcwEjo92nVm SrhOOKr1FO5cL8jmeLNlNDoBT3/vE+zXBsmgNCMrV7jF0lc/1blto88GvN2JbQuqUrk6 eEFA== X-Received: by 10.107.16.84 with SMTP id y81mr9337717ioi.19.1447960189482; Thu, 19 Nov 2015 11:09:49 -0800 (PST) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:99085 On Fri, Nov 20, 2015 at 5:50 AM, BartC wrote: > But you're not going to tell me what it is I got wrong! > > I said that Python's "=" does a very shallow copy. And I stated that in A=B, > something of B must be copied into A. > > I (and probably others) would like to know why none of that is correct. But > I suspect I'm not wrong. There's no copying happening. You evaluate the expression `B`, and get back some kind of object (because all expressions in Python evaluate to objects, unless they raise exceptions or in some way don't finish evaluating). The name A then becomes bound to that object. You're not copying a reference; you're simply referencing the result of an expression. PLEASE finish reading Ned's talk. Here's the link again: http://nedbatchelder.com/text/names1.html It is an excellent explanation of the exact points you're confused about. ChrisA