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: Wed, 25 Nov 2015 10:56:27 +0100 Lines: 38 Message-ID: References: <56546985.8060704@rece.vub.ac.be> <56547337.4000709@rece.vub.ac.be> <56547C53.8030407@rece.vub.ac.be> <5654864E.2070906@rece.vub.ac.be> <56549324.8020607@rece.vub.ac.be> <56549F15.40206@rece.vub.ac.be> <5654B037.6020107@rece.vub.ac.be> <56550273$0$1585$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de cgfd+A7zstYXL9+8Z0cTyQ8nx0SsOsADWDtWKfh0w3qw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'value,': 0.03; 'compiler': 0.05; 'context': 0.05; 'none,': 0.05; 'received:134': 0.05; 'expressions': 0.07; '(1,': 0.09; 'constants.': 0.09; 'immutable': 0.09; 'literal': 0.09; 'tuple': 0.09; 'wed,': 0.15; '(),': 0.16; '(x,': 0.16; '2),': 0.16; 'constants': 0.16; 'displays.': 0.16; 'literal.': 0.16; 'literals': 0.16; 'literals.': 0.16; 'received:ac.be': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'runtime.': 0.16; 'summarize': 0.16; 'wrote:': 0.16; 'load': 0.20; '2015': 0.20; 'constant': 0.22; 'am,': 0.23; 'code.': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'if,': 0.29; 'notation': 0.29; 'so-called': 0.29; 'e.g.': 0.30; 'received:be': 0.30; 'fixed': 0.31; 'point': 0.33; 'source': 0.33; 'picking': 0.33; 'science,': 0.33; 'smart': 0.33; 'steven': 0.33; 'case,': 0.34; 'done': 0.35; 'nov': 0.35; 'something': 0.35; 'but': 0.36; 'loaded': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'expect': 0.37; 'to:addr:python.org': 0.40; 'called': 0.40; 'needing': 0.63; 'treat': 0.72; 'special': 0.73; "d'aprano:": 0.84; 'extra.': 0.84; 'pardon': 0.84; 'schreef': 0.84 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnMHAAeFVVaGuA9G/2dsb2JhbABehFcBwFeGDwKCDQEBAQEBAYU/AQEBAwEjVQYLCxgCAgUWCwICCQMCAQIBRRMIAogiCK1VjA6EJQEBCAIhgQGFU4R+hSeCToFEBZZVjTKBW4c0M5MWY4QFhh0BAQE User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.8.0 In-Reply-To: <56550273$0$1585$c3e8da3$5496439d@news.astraweb.com> 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:99430 Op 25-11-15 om 01:36 schreef Steven D'Aprano: > On Wed, 25 Nov 2015 08:25 am, Antoon Pardon wrote: > >> The point is that a >> tuple can just be loaded as a constant without needing something extra. > > How would one load this tuple as a constant? > > (myfile.read(), "%.5f" % sin(x or y)) Picking nits again. That respons was done in a context fo what I called literals. Do you expect me to summarize the context in each response? > The point is that *in general*, tuple so-called "literals" (what the docs > call displays) cannot be loaded as constants. If, and only if, the tuple > contains nothing but immutable constants e.g. > > (1, 2.0, None, "spam") > > then a sufficiently smart compiler may be able to treat that specific tuple > as a constant/literal. But that's a special case, and cannot be generalised > to all tuple displays. > > All tuple so-called "literals" e.g. (), (1, 2), (x, y, z) etc. are > fundamentally expressions that *may* have to be built at runtime. Hence the > word "literal" is inappropriate. Literals are constants. So (x, y, z) is not a literal. This is what wikipedia says: In computer science, a literal is a notation for representing a fixed value in source code. Since (x, y, z) is not a fixed value, it is not a literal. -- Antoon.