Path: csiph.com!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 00:45:19 +1100 Lines: 16 Message-ID: References: <564dbe6b$0$1610$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de oLRTy3qqIaOwN7JwmyYmowgiMggtwSwlZQ3L3zeqA+Pg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:209.85.223': 0.03; 'assignment': 0.07; 'default.': 0.07; 'differently': 0.07; 'cc:addr:python-list': 0.09; "'default'": 0.09; 'python': 0.10; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'shallow': 0.16; 'volatile': 0.16; 'wrote:': 0.16; 'variable': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'am,': 0.23; 'header :In-Reply-To:1': 0.24; 'feature': 0.24; 'fri,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'actual': 0.28; 'that.': 0.30; 'certain': 0.31; 'everyone': 0.31; 'another': 0.32; 'received:google.com': 0.35; 'nov': 0.35; 'knowledge': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'things': 0.38; 'received:209': 0.38; 'where': 0.40; 'some': 0.40; 'watch': 0.62; '20,': 0.66; 'circle': 0.66; 'one-time': 0.66; 'chrisa': 0.84; 'local,': 0.84; 'presumably': 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=8QevQ+JkiBQtBocv/WeEFaC62jTv5sbRfhnzYSOhWt0=; b=rWK2PQbPrIVDd2EI/2hpbCqm0K7BVw/Mo4wsmqjtxpM9WnW2xChpbC9twKMDPN3TeS WWi1Z5Q2uRx+w+IOk3zT65l3d2/JiFYn/qNdTlMY+hlFhg02e5+96QKJ9nWHg539gtvs j87ZyXdDNMyVxTx36Mnc8ZJZfzNpBmVjQeP09MzwXOKYOOYcQmXZb67lueLwkw96u4os AD+IX+dxoDL0zp99N3g6tU2qsmfdpkL7ZHWCOkbzu0k24smnkcY7NRAYL1g23fuWrpl8 /4XchY9YBg9NHh7rDMUHrvrE+2BvTwrMW5R7nR58Vu1TqJ9HbWb/V4t3o4+Zti2l01p/ 7Xcw== X-Received: by 10.107.10.233 with SMTP id 102mr8245992iok.31.1447940719589; Thu, 19 Nov 2015 05:45:19 -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:99058 On Fri, Nov 20, 2015 at 12:19 AM, BartC wrote: > You presumably think differently because you have some inside knowledge of > how Python works, and know that that [] undergoes a one-time assignment to a > local, persistent 'default' variable where it's value can indeed by changed. > (Thanks to another Python feature where an assignment is a very shallow copy > of an object.) And it is that volatile variable that is the actual default. > > But not everyone is going to know that. Correct: We think certain things because we understand how Python behaves. You, too, can join the Inner Circle of Pythonistas; all you have to do is read this (and/or watch the video): http://nedbatchelder.com/text/names1.html ChrisA