Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Late-binding of function defaults (was Re: What is a function parameter =[] for?) Date: Thu, 26 Nov 2015 03:29:41 +1100 Lines: 18 Message-ID: References: <87d1v5emhl.fsf@elektro.pacujo.net> <564e6a62$0$1620$c3e8da3$5496439d@news.astraweb.com> <565592e9$0$1615$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de PfeFR6C9f7vtQkkVlmu41QlwzKzSIkf16ln/wklJneBw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'received:209.85.223': 0.03; 'alias': 0.07; 'append': 0.07; 'assignment': 0.07; 'cc:addr:python-list': 0.09; 'augmented': 0.09; 'effect.': 0.09; 'python': 0.10; 'language,': 0.11; 'subject: \n ': 0.15; 'thu,': 0.15; '1",': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'mean,': 0.16; 'received:209.85.223.173': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'semantically': 0.16; 'subject:?)': 0.16; 'who?': 0.16; 'wrote:': 0.16; 'expanded': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'programming': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; '(which': 0.26; 'message-id:@mail.gmail.com': 0.27; 'operators': 0.29; 'languages': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'nov': 0.35; 'but': 0.36; 'list,': 0.36; 'instead': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'agree': 0.37; 'things': 0.38; 'difference': 0.38; 'received:209': 0.38; 'subject:-': 0.39; 'some': 0.40; 'high': 0.60; 'hope': 0.61; 'skip:u 10': 0.61; 'school': 0.62; '26,': 0.72; 'surprise': 0.72; 'you:': 0.79; 'actually,': 0.84; 'batchelder': 0.84; 'chrisa': 0.84; 'obvious.': 0.84; 'absolutely': 0.88; '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=qtQELQE34FsZt2M8vWTImmHxQbYs+k+kIBZT/kRGSVg=; b=xRh9IWGiua+rogGk8xMjh0sawDexLKN1HEPMQbARnAumg900/hH3sgwYKszucO25q5 fYuBqzCnTD72G09OObEI/x1trQCXBk5LbOy/CaSnm16xci5ye1/nZnIJDCvE7/rnlxbG mOiAYTz8KwScvKlVKJhV82l86GdR9dYvlVgT8tomQHQ1nrE7L/x6Ea3Hme2Yk7aVpiNg nTIAAeMVtpjpIy6fDP9Jn2hwQjaNE1T5rboBuT4XdWEpb45uZETgQdcKSMwN93mjt8PZ dm1g+yR+o/f+2mcYbMPhTzyj2mOpqFffzA2DTXx57/RWOORNA+A0ubS55TD4GMNjYOCs PhzQ== X-Received: by 10.107.16.84 with SMTP id y81mr33927399ioi.19.1448468981917; Wed, 25 Nov 2015 08:29:41 -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:99463 On Thu, Nov 26, 2015 at 2:13 AM, Ned Batchelder wrote: > I agree with you: there are things about Python that surprise people. > That's because it's a programming language, and very very little about > programming languages is obvious. The best we can hope for is "familiar," > and even then, familiar to who? High school algebra students will at > first be baffled by "x = x + 1", an equation which is clearly > unsatisfiable. And then *lots* of people are confused by "x += 1" being almost, but not entirely, identical to the above. Actually, if there were one change I could make to Python, it would be to redefine the augmented assignment operators to be semantically identical to their expanded forms; there might be some optimizations, but absolutely no difference in effect. (Which would mean, among other things, that it would be a very bad way to append to a list, instead of being an alias for .extend.) ChrisA