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: Wed, 25 Nov 2015 02:17:14 +1100 Lines: 28 Message-ID: References: <564dbe6b$0$1610$c3e8da3$5496439d@news.astraweb.com> <564df258$0$1604$c3e8da3$5496439d@news.astraweb.com> <8601c9af-a7d9-4642-ba1c-8edd1e4c3390@googlegroups.com> <56546985.8060704@rece.vub.ac.be> <56547337.4000709@rece.vub.ac.be> <56547C53.8030407@rece.vub.ac.be> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de 00JQOTsJwKUqtKKKFap4lg6shDyu1P2x1YlD7Hrrc58w== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'received:209.85.223': 0.03; 'constructor': 0.07; 'squares': 0.07; 'cc:addr:python-list': 0.09; 'literal': 0.09; 'wed,': 0.15; 'constructor.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'literal,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; '>>>': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'saying': 0.22; 'am,': 0.23; 'header :In-Reply-To:1': 0.24; "doesn't": 0.26; 'chris': 0.26; 'message- id:@mail.gmail.com': 0.27; "i'm": 0.30; 'received:google.com': 0.35; 'nov': 0.35; "isn't": 0.35; 'received:209.85': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'display': 0.37; 'received:209': 0.38; 'sure': 0.39; 'does': 0.39; 'rather': 0.39; "you'll": 0.61; 'confirm': 0.62; 'angelico:': 0.84; 'chrisa': 0.84; 'confusion.': 0.84; 'pardon': 0.84; 'schreef': 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=WTUA+DMweoT/MvLoa9aDI0MnSM4SGH94pdTQmnWGwRs=; b=nGtpV0Rxzi6xCWFlaGd3Vw2kaR4bafrYC6N4k3Rh6Btoo02qKcgkGyu5S/PnyE27W6 M+1VfJRbk+OWPLyStbHKUXYHIhqZae6b+O1qQklsotgFcQi/3rDOM0Klc6vJn0gPAhRT e2IJ7ewab6SP8zRKw6oZm4QJnx3YRmfu+cB4EvoZiojK/XEnjk5AaNojXUaUc7JdP4p3 J8Kc37g2V3bDrltoRApLjScUJpZX8FExo2CVa+9mIoaGavXrhkzI2oP5yNY/wEErzd6R EBfRevGAW35WgdzB2Kh0/3nAcWIqBZ/SLkJ3L9wSiDfUpBSpXyfpdb3+IXoPJPN0gJ+L l44Q== X-Received: by 10.107.3.163 with SMTP id e35mr28170389ioi.157.1448378234538; Tue, 24 Nov 2015 07:17:14 -0800 (PST) In-Reply-To: <56547C53.8030407@rece.vub.ac.be> 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:99354 On Wed, Nov 25, 2015 at 2:03 AM, Antoon Pardon wrote: > Op 24-11-15 om 15:34 schreef Chris Angelico: >> On Wed, Nov 25, 2015 at 1:24 AM, Antoon Pardon >> wrote: >>>> Start thinking of it as a constructor call rather than a literal, and >>>> you'll get past most of the confusion. >>> >>> That doesn't change the fact it does look like a literal and not like >>> a constructor. >> >> Then explain how this is a literal: >> >> squares = [x*x for x in range(int(input("How far? ")))] > > So are you saying > > () isn't a literal > > because > > (x * x for x in range(int(input("How far? ")))) isn't a literal? I'm pretty sure tuple/list/dict display predates comprehensions, and was already not a literal syntax. Steven, you know the history better than I do - confirm or deny? ChrisA