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, 26 Nov 2015 00:50:59 +1100 Lines: 38 Message-ID: References: <56544BAB.9020709@rece.vub.ac.be> <874mgbpnb5.fsf@elektro.pacujo.net> <486929d1-4caa-403c-89e6-c45d7b447f98@googlegroups.com> <5655035c$0$1609$c3e8da3$5496439d@news.astraweb.com> <201511250055.tAP0tpfO005889@fido.openend.se> <87egfent2i.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de t7ONlHlSaNp2bRQchnwyhQoo/mXCczq1qSipi6aU3mfg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'received:209.85.223': 0.03; 'assignment': 0.07; 'cc:addr:python-list': 0.09; 'operator,': 0.09; 'rounding': 0.09; 'statements': 0.09; 'throw': 0.09; 'python.': 0.11; 'def': 0.13; 'wed,': 0.15; 'mathematics': 0.15; '"x"': 0.16; 'eternal': 0.16; 'fancy': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'modified.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'substitute': 0.16; 'wrote:': 0.16; 'language': 0.19; 'math': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'aspect': 0.22; 'context.': 0.22; 'programming': 0.22; '(or': 0.23; 'header:In-Reply-To:1': 0.24; 'sort': 0.25; "doesn't": 0.26; 'message-id:@mail.gmail.com': 0.27; 'mathematical': 0.27; 'function': 0.28; 'branches': 0.29; 'helpful.': 0.29; 'code': 0.30; 'extend': 0.31; 'problem': 0.33; 'equal': 0.34; 'languages': 0.34; 'gives': 0.35; 'received:google.com': 0.35; 'nov': 0.35; 'programming.': 0.35; "isn't": 0.35; 'sometimes': 0.35; 'but': 0.36; 'too': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'possible': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'received:209': 0.38; "didn't": 0.39; 'where': 0.40; 'still': 0.40; 'some': 0.40; 'your': 0.60; 'school': 0.62; 'making': 0.62; 'between': 0.65; 'soon': 0.65; 'body.': 0.66; 'statement,': 0.66; 'discover': 0.73; 'truth': 0.79; 'introduce': 0.79; 'chrisa': 0.84; 'expect.': 0.84; 'pure,': 0.84; 'together,': 0.84; 'to:none': 0.91; 'notion': 0.91; 'average': 0.93 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=gKm1gBm9gxPcdAd4pz9jmCU9dt8d/52I9Wxhl54bAog=; b=S65BFXGvfAY1JCZI84hY+xovYZn/grf0zJ8+J/iJqf/NvMUhCdfM0I0rddqqy1y1od 3ZEN2MIrED8ybM0KuG/88yNf/6z8YJydam8EUbZeHs0z8xYaLE3Xl2xZKEHw0BBVk7v0 AXdKQZ0M2oS7Roq7u0u3Z9NZ4ncCYsOERRPredsVYo0KKFmKID62EgCp9NyISyNg1+Cb ERUeJO5UnQ+CAUXbI/G3JWB5NgCNBiFbcn022BdP1+bXWn0H0R6C5A8s2X/MNguNDHcW s9bxi4LqwzPn219ELl8BlRdZKV20pxFM5Q9XtTVvVWDfWuniV/2nYrGhqS9ilSyTyv5G oh1g== X-Received: by 10.107.3.163 with SMTP id e35mr32840488ioi.157.1448459459920; Wed, 25 Nov 2015 05:50:59 -0800 (PST) In-Reply-To: <87egfent2i.fsf@elektro.pacujo.net> 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:99451 On Wed, Nov 25, 2015 at 11:48 PM, Marko Rauhamaa wrote: > I think "binding" is too fancy a word to be used with conventional > programming languages like Python. If your programming language has an > assignment statement, "binding" is even nonsensical. Consider: > > def f(x): > x += 1 > return 2 * x > > Now we would have this reduction: > > f(7) > => > 7 += 1; return 2 * 7 > > because "x" would be bound to "7" everywhere in the function body. This is exactly the sort of problem that inevitably happens when you try to extend mathematics into programming. Most branches of mathematics are simply looking at pure, eternal statements of truth; if once you discover (or decide) that x is equal to 7, you can perfectly substitute one for the other in any context. There is no chronology - x has always been equal to 7, you just didn't know it until now. It's possible to write code this way, and there are benefits to it, but as soon as you have an assignment operator, you're introducing a whole aspect of chronological truth that math lacks, so some concepts ARE going to need to be modified. However, that doesn't stop us from making use of terminology, where it's helpful. We know from grade school that adding two numbers together and dividing by 2 gives us the average, or the midpoint between them. Programming languages introduce the notion of adding two strings together, and also throw the curve-ball at us that sometimes the average isn't the same as the perfect mathematical average (due to rounding or other issues). But we'll still call that operation adding, and we'll still have avg() functions that do what we broadly expect. ChrisA