Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder5.xlned.com!news2.euro.net!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'dict': 0.09; 'literal': 0.09; 'subject:while': 0.09; 'to:addr:comp.lang.python': 0.09; 'tuple': 0.09; 'cc:addr:python-list': 0.10; 'char"': 0.16; 'clash': 0.16; 'declaration': 0.16; 'expressions.': 0.16; 'for,': 0.16; 'literals': 0.16; 'nesting': 0.16; 'syntax.': 0.16; 'thread.': 0.16; 'tuple,': 0.16; 'tuples,': 0.16; 'wrote:': 0.17; 'proposed': 0.20; 'sort': 0.21; 'earlier': 0.21; 'parse': 0.22; 'tuples': 0.22; 'cc:2**0': 0.23; 'monday,': 0.23; 'this:': 0.23; 'cc:no real name:2**0': 0.24; "we'd": 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'looks': 0.26; 'easiest': 0.27; 'this?': 0.28; 'received:209.85.212': 0.28; 'chris': 0.28; 'fine': 0.28; 'depth': 0.29; 'grouping': 0.29; 'function': 0.30; 'could': 0.32; '11,': 0.33; 'like:': 0.33; 'received:google.com': 0.34; '(1)': 0.34; 'list': 0.35; 'doing': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.36; 'too': 0.36; 'does': 0.37; 'received:209': 0.37; 'far': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'short': 0.39; 'where': 0.40; 'end': 0.40; 'side': 0.61; 'more': 0.63; '2013': 0.84; 'call!': 0.84; 'confusing': 0.84; 'pike': 0.84; 'vehemently': 0.84; 'poorly': 0.93 X-Received: by 10.50.108.137 with SMTP id hk9mr463434igb.15.1360588440831; Mon, 11 Feb 2013 05:14:00 -0800 (PST) Newsgroups: comp.lang.python Date: Mon, 11 Feb 2013 05:13:58 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=70.196.110.97; posting-account=h3aEwQoAAACiuqX-oR3gvCVFm8lLHoWj References: <86872ad2-fda0-403b-9f18-d1cb18e41860@t32g2000yqd.googlegroups.com> <50039290$0$29978$c3e8da3$5496439d@news.astraweb.com> <9309333c-13a0-464c-bd94-9c682363b8c9@googlegroups.com> <511516db$0$29969$c3e8da3$5496439d@news.astraweb.com> <62c3e7bb-d023-43b4-b759-f424707fd346@googlegroups.com> <75c82449-773e-4077-a6c9-e9cef08f845f@googlegroups.com> <13e5e306-d253-418e-a1b2-ac5bde03f07d@googlegroups.com> <5117868b$0$29998$c3e8da3$5496439d@news.astraweb.com> <375e9978-54a2-421a-a1fa-7f39cafc4f31@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 70.196.110.97 MIME-Version: 1.0 Subject: Re: Implicit conversion to boolean in if and while statements From: Rick Johnson To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 49 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360588449 news.xs4all.nl 6986 [2001:888:2000:d::a6]:35685 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38678 On Monday, February 11, 2013 6:40:23 AM UTC-6, Chris Angelico wrote: > [...] > Or doing what you were pointing and laughing at Pike for, and using > two-symbol delimiters. You could even make it majorly logical: >=20 > list_ =3D [[ 1, 2, 3 ]] > tuple_ =3D ([ 1, 2, 3 ]) > dict_ =3D [{ 1, 2, 3 }] > frozendict_ =3D ({ 1, 2, 3 }) > set_ =3D [< 1, 2, 3 >] > frozenset_ =3D (< 1, 2, 3 >) I am vehemently against using more than one "opening seq char" and one "clo= sing seq char". It works fine for single depth sequences, however, once you= start nesting the mental focus required to parse the doubled openers/close= rs is headache inducing. I would accept wrapping the literal in some sort o= f declaration though, something like i proposed earlier in the thread. The = easiest is to use: set({1,2,3}) but that looks like a function call! So we'd need a unique syntax. Either a= single tag like: set{1,2,3} Or we could use start and end tags like: set{1,2,3}set where "set{" and "}set" are delimiters. For lists, tuples, and dict we woul= d use the short form because these literals are far too ubiquitous: [1,2,3] # list {k:v} # dict (1,2,3) # tuple However, the grouping chars for tuples has always been confusing because th= ey can clash with grouping of expressions. What is this? (1) It's NOT a tuple! But it looks like a tuple! What is this: 1,2 it IS a tuple, but it does not look like a tuple!=20 That's an unfortunate side effect of a poorly thought-out tuple syntax.=20