Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Antoon Pardon Newsgroups: comp.lang.python Subject: Re: What is a function parameter =[] for? Date: Tue, 24 Nov 2015 13:48:25 +0100 Lines: 24 Message-ID: References: <56544BAB.9020709@rece.vub.ac.be> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de zqszAT1BLA+VuAepEFfKBQWELUXXPiZ4fhuGouCQR3kw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'value,': 0.03; 'correct.': 0.07; 'objects,': 0.07; 'arg': 0.09; 'mutable': 0.09; 'value.': 0.15; '*never*': 0.16; '*values*': 0.16; '24,': 0.16; 'defaults.': 0.16; 'executed,': 0.16; 'function?': 0.16; 'mutated': 0.16; 'received:adsl-dyn.isp.belgacom.be': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'byte': 0.18; '>>>': 0.20; '2015': 0.20; 'object.': 0.22; 'code,': 0.23; 'seems': 0.23; "haven't": 0.24; 'thus': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'chris': 0.26; 'received:192.168.1.3': 0.29; 'talked': 0.29; 'code': 0.30; 'received:be': 0.30; 'certain': 0.31; 'statement': 0.32; 'source': 0.33; 'impression': 0.33; 'values.': 0.33; 'tue,': 0.34; 'gets': 0.35; 'gives': 0.35; 'so,': 0.35; 'could': 0.35; 'nov': 0.35; 'something': 0.35; 'but': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'no,': 0.38; 'anything': 0.38; 'someone': 0.38; 'why': 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'default': 0.61; 'yes': 0.62; 'charset:windows-1252': 0.62; 'talking': 0.67; 'angelico:': 0.84; 'pardon': 0.84; 'received:195.238': 0.84; 'schreef': 0.84; 'have.': 0.93 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2CWAQBwW1RW/9Xi9VENUYR9wRmGDwKBchABAQEBAQEBhT8BAQR4EQsYCRYPCQMCAQIBRRMGAgKIL61EjHmEJgEBCAIBIIZUhH6FJ4QSAQSWUI0xnEs4gjwdgVdxAYUqAQEB User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 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:99324 Op 24-11-15 om 13:07 schreef Chris Angelico: > On Tue, Nov 24, 2015 at 10:36 PM, Antoon Pardon > 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. >> >> No, he is talking about the value. Since the object can be mutated >> and thus have an other value, his statement seems correct. > > With mutable objects, you can *never* depend on their values. Any time > ANY byte code gets executed, the value could change. That's why I have > never said anything about *values* of arg defaults. Yes you have. You haven't mentioned them yourself. But when you contradict the statement of someone and that person talked about values, then in contradicting that statement you said something about values. You then switching to talking about objects, just gives the impression that object is a synonym for value. -- Antoon