Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Random832 Newsgroups: comp.lang.python Subject: Re: What is a function parameter =[] for? Date: Tue, 24 Nov 2015 16:28:58 +0000 (UTC) Lines: 24 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> X-Trace: news.uni-berlin.de heKlNTKu72euFhmbMx6dyQ1t64mct7A40/qnJtT0GkNA== 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; 'constructor': 0.07; 'literal': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'assume': 0.11; 'syntax': 0.13; 'wed,': 0.15; 'confusion': 0.16; 'constructor.': 0.16; 'hides': 0.16; 'literal,': 0.16; 'literals': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'token,': 0.16; 'wrote:': 0.16; '>>>': 0.20; '2015': 0.20; 'tuples': 0.22; 'am,': 0.23; 'seems': 0.23; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'header:X-Complaints-To:1': 0.26; 'chris': 0.26; 'define': 0.27; 'idea': 0.28; 'values': 0.28; 'regardless': 0.31; 'received:comcast.net': 0.33; 'nov': 0.35; "isn't": 0.35; 'but': 0.36; 'should': 0.36; '(and': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'list.': 0.37; 'things': 0.38; 'itself': 0.38; 'does': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'still': 0.40; "you'll": 0.61; 'is.': 0.63; 'confusion.': 0.84; 'pardon': 0.84; 'from.': 0.93 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: c-68-39-146-59.hsd1.in.comcast.net User-Agent: slrn/pre1.0.3-7 (Linux) 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:99363 On 2015-11-24, Chris Angelico wrote: > 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. > > Neither of them is a literal, even though one of them isn't even > constructing a list. Tuples may be constant, but they still don't have > a literal form. How do you define "literal form"? I define it as any syntax that can participate in ast.literal_eval (And I consider [...] to be a literal form regardless of whether the ... values are literals or not). I don't think "Start thinking of it as a constructor call rather than a literal" is helpful, since it just hides one's confusion about what a literal is. The Python documentation itself seems to assume that "literal" should only be used for things that are a single token, though I have no idea where this thinking comes from.