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: Thu, 19 Nov 2015 22:58:33 +1100 Lines: 12 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de ityWExVhltnDHxr9+LhM8wSfsRAiKv60XE0oUyucseUg== 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; 'defines': 0.07; 'type,': 0.07; 'cc:addr:python-list': 0.09; 'python': 0.10; 'thu,': 0.15; '*function': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'header :In-Reply-To:1': 0.24; "doesn't": 0.26; 'message- id:@mail.gmail.com': 0.27; 'said,': 0.27; 'regardless': 0.31; 'certain': 0.31; 'call,': 0.33; 'received:google.com': 0.35; 'nov': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'no,': 0.38; 'received:209': 0.38; 'means': 0.39; 'default': 0.61; 'per': 0.62; 'chrisa': 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=PMHVrW7lE4JoH6CB7m6gptOL7TqeXdFZSXYycm22y6o=; b=he2InWMtAOX0ni3ryBe2Kh9RrfrK8S7/MOyxVR+0YAncxu0ulwx63DT4vEJD9Loqqq Q3qy0Ot+uyIqPuyZ8xALoygJ2yxvYox2sRJdfT+XKOUCaCSg2ctIwGXosktLCBtmjOVg P2kc69jjMTidNstwFURuqmQNnOV3pjG2f/llXXaW1i1/ItAatSPcz460iGl5mL9AmRoc SNtUQHj69SDxHXc/oO9dZSeZYGFqUUkZfh5eav40n09FpApgICPCeUFDaBWbib1ywXuY myZwPGHg9swPPdXc3aNie+wY3F05qEEhrnlWsV8/wBjF2GgCGbBRDk6dB7qHM5i0tmwD Sdzg== X-Received: by 10.107.10.233 with SMTP id 102mr7788354iok.31.1447934314106; Thu, 19 Nov 2015 03:58:34 -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:99050 On Thu, Nov 19, 2015 at 10:41 PM, BartC wrote: > As I said, it's bizarre. It means that for certain types, Python doesn't > have a default that works per call, but only a default that works once per > program. No, it's not "for certain types". Regardless of the type, the expression that defines the default is evaluated at *function definition*, not at each *function call*. (That's not the same as "once per program", although for 99% of situations, it'll be indistinguishable.) ChrisA