Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: What is a function parameter =[] for? Date: Wed, 18 Nov 2015 17:02:39 -0700 Lines: 17 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de 2KFAmZiyLt/IdhDktj5TPAFo+ezkCddAquk/up/QlLHA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'received:209.85.223': 0.03; 'def': 0.13; 'wed,': 0.15; 'thu,': 0.15; 'function?': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; '>>>': 0.20; '2015': 0.20; 'object.': 0.22; 'am,': 0.23; 'code,': 0.23; 'bit': 0.23; 'header:In-Reply-To:1': 0.24; 'chris': 0.26; 'message-id:@mail.gmail.com': 0.27; 'certain': 0.31; 'source': 0.33; 'received:google.com': 0.35; 'so,': 0.35; 'nov': 0.35; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'to:addr:python.org': 0.40; 'some': 0.40; 'default': 0.61; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=04UIlmeWC/aLukmJa+VnD5Pj+FDK59xi/wtioW85Pa0=; b=OVEmZLRZaVYBNWX7hxZC1CXqC766ZOvVkKOEu5bNCAqqaFcfjktayW5PIFRkfZ4xGe xYnVfOPtJaOx++wbesCj0C2Y+dxOedAUErKXu6Ok6170QH1ndKACdMm5Ty9lvq0IiDza WlH7Re2DDjmZ4Zc9QWQG9SIUfntrqFTr929IFP6vmKBwN6749BeBvWYFccEEBmuxqTSI qYCiAWoP4eJHLDtZT//UIsP67DBUvrx2oU0Am7xLyxLLwTpKNc3DJvVQO5oThX/AFDLu a/HivOUIsHXQP8RLZeUIbKFMA9Vq9lmn3HgpcyJz2VnkzFaoVh59+bSYXXIsoUDEfcam bOiA== X-Received: by 10.107.137.226 with SMTP id t95mr5677316ioi.188.1447891398970; Wed, 18 Nov 2015 16:03:18 -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:99014 On Wed, Nov 18, 2015 at 4:22 PM, Chris Angelico wrote: > On Thu, Nov 19, 2015 at 10:14 AM, BartC wrote: >> So, looking at some source code, a default value for certain types is only >> certain to be that value for the very first call of that function? > > On the contrary, it is certain always to be that exact object. "Certain" may be a bit overly strong. >>> def f(x=42): ... return x ... >>> f() 42 >>> f.__defaults__ = (43,) >>> f() 43