Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail 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; 'element': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'trailing': 0.09; 'jan': 0.12; 'comma': 0.16; 'commas,': 0.16; 'one-element': 0.16; 'optional': 0.16; 'parentheses': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:Java': 0.16; 'tuple': 0.16; 'tuple,': 0.16; 'tuple.': 0.16; 'tuples,': 0.16; 'wrote:': 0.18; 'header :User-Agent:1': 0.23; '(a)': 0.24; 'instead.': 0.24; '(or': 0.24; 'subject:/': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; '(which': 0.31; 'code': 0.31; 'tuples': 0.31; 'created': 0.35; 'except': 0.35; 'but': 0.35; 'needed': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'ian': 0.60; 'most': 0.60; 'surrounding': 0.68; 'prohibited': 0.69; 'received:fios.verizon.net': 0.84; 'subject:experience': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Bitten by my C/Java experience Date: Mon, 04 May 2015 16:06:29 -0400 References: <87r3qwid3u.fsf@Equus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-98-114-97-173.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 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: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1430770004 news.xs4all.nl 2839 [2001:888:2000:d::a6]:50329 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:89929 On 5/4/2015 1:43 PM, Ian Kelly wrote: > * () is a zero-element tuple, and (a, b) is a two-element tuple, > but (a) is not a one-element tuple. Tuples are created by commas, not > parentheses, so use (a,) instead. Which means that a, and a,b (or a,b,) are 1 and 2 element tuples respectively. Except for empty tuples, parentheses are optional unless needed to fence off the tuple from surrounding code (which happens to be most of the time, but not always). A trailing comma is prohibited for zero element tuples, required for one element tuples, and optional for multiple element tuples. -- Terry Jan Reedy