Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'syntax': 0.04; 'argument': 0.05; 'explicitly': 0.05; 'tree': 0.05; 'context': 0.07; 'correct.': 0.07; 'expressions': 0.07; 'indicated': 0.07; 'string': 0.09; 'atom': 0.09; 'excluding': 0.09; 'funny,': 0.09; 'imply': 0.09; 'inclusion': 0.09; 'literal': 0.09; 'parsing': 0.09; 'repeated': 0.09; 'replied': 0.09; 'strings.': 0.09; 'subject:Why': 0.09; 'wrong,': 0.09; 'wrote': 0.14; '"is': 0.16; '"or"': 0.16; '"some': 0.16; '(it': 0.16; '*you*': 0.16; 'and_expr': 0.16; 'and_test': 0.16; 'argument.': 0.16; 'ast': 0.16; 'convey': 0.16; 'definitions,': 0.16; 'disclaim': 0.16; 'explicitly,': 0.16; 'expression).': 0.16; 'expression,': 0.16; 'ignoring': 0.16; 'indirectly': 0.16; 'informal': 0.16; 'invalid.': 0.16; 'it."': 0.16; 'literals': 0.16; 'node,': 0.16; 'node.': 0.16; 'not_test': 0.16; 'or_test': 0.16; 'parse,': 0.16; 'shift_expr': 0.16; 'simple_stmt': 0.16; 'statement.': 0.16; 'statement;': 0.16; 'subject: \n ': 0.16; 'subject:comment': 0.16; 'subject:quoted': 0.16; 'subject:simple': 0.16; 'subject:triple': 0.16; 'sure.': 0.16; 'surprising': 0.16; 'xor_expr': 0.16; 'demonstrate': 0.16; 'ignore': 0.16; 'language': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'pointed': 0.19; 'later': 0.20; 'written': 0.21; 'seems': 0.21; '(the': 0.22; '>>>': 0.22; 'otherwise,': 0.22; 'rules': 0.22; 'separate': 0.22; "aren't": 0.24; 'instead.': 0.24; 'logical': 0.24; 'parse': 0.24; 'sorry,': 0.24; 'text,': 0.24; 'looks': 0.24; '(or': 0.24; 'question': 0.24; 'source': 0.25; 'first,': 0.26; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'point': 0.28; 'correct': 0.29; 'am,': 0.29; 'possibility': 0.29; 'topic': 0.29; 'statement': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'gives': 0.31; 'included': 0.31; "skip:' 10": 0.31; 'that.': 0.31; 'you?': 0.31; '(although': 0.31; 'comparison': 0.31; 'context,': 0.31; 'context.': 0.31; 'factor': 0.31; 'fine,': 0.31; 'go.': 0.31; 'node': 0.31; 'noted': 0.31; 'produces': 0.31; 'yes.': 0.31; 'entirely': 0.33; 'not.': 0.33; 'actual': 0.34; 'sense': 0.34; 'could': 0.34; 'offered': 0.35; '(that': 0.65; 'skip:\xe2 10': 0.65; 'talking': 0.65; 'thomas': 0.65; 'within': 0.65; 'note:': 0.66; 'here': 0.66; 'subject:. ': 0.67; 'side': 0.67; 'between': 0.67; 'mar': 0.68; 'production': 0.68; 'burden': 0.68; 'invalid': 0.68; 'statement,': 0.68; 'presented': 0.69; 'stated': 0.69; 'construction': 0.72; '8bit%:43': 0.74; 'theoretical': 0.74; 'viewed': 0.74; 'power': 0.76; '\xe2\x80\x93': 0.77; '8bit%:46': 0.78; '2015': 0.84; 'actually,': 0.84; 'confusion.': 0.84; 'important;': 0.84; 'stubbornly': 0.84; '\xe2\x80\xa6': 0.84; 'acknowledge': 0.93; 'quotation': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=EpvdeUIr42ADErKgndRH2fH2LGhgESWSwsHqHDwWuDE=; b=ZKpMQTdYD1bbnXa1Q1fvFJerynNZdg/ZDLjTkL8EzGzP39He0ZYxB/eOFU5ZrcgnTv Qp82WmrVZiteemyvhXeTgyTNV9hfS9N80c6SMVW5oMgq3lQJcvpsErkmleWDMlKUNo1N iUJpu7gTlPcP4GKGXnzzKIDEOZgUmb+gBkqpgg90wirw8nmQLNqMWkX3/Kct7bCluX1C Yp27Pg1rcqF7ea+HeI4Pxf3zLzaK7gSIZUz8OYUe5/u4vIDEa82RJEF5FIhfApUHB/rd EhRTx0G0RmVzGRB1+MUP4MqXkDji7NULb91CKfTrTvd/42+P3TzYyi3AGSUYU2mUw8rH 8Xyw== X-Received: by 10.68.220.227 with SMTP id pz3mr65499261pbc.72.1427786673398; Tue, 31 Mar 2015 00:24:33 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <3894022.plrvF2nHWu@PointedEars.de> References: <3533816.ZYnZ2OzjCs@PointedEars.de> <3971951.908YQu3oQO@PointedEars.de> <1504323.jUKfeKbQsP@PointedEars.de> <2362875.FIK8ImHTJA@PointedEars.de> <1823599.Pr2V0MPR6q@PointedEars.de> <9781856.5cutuNVPEq@PointedEars.de> <3894022.plrvF2nHWu@PointedEars.de> From: Ian Kelly Date: Tue, 31 Mar 2015 01:23:53 -0600 Subject: Re: A simple single line, triple-quoted comment is giving syntax error. Why? To: Python Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 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: 174 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1427786682 news.xs4all.nl 2962 [2001:888:2000:d::a6]:56665 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88368 On Sun, Mar 29, 2015 at 4:41 AM, Thomas 'PointedEars' Lahn wrote: > Ian Kelly wrote: > >> [=E2=80=A6] Thomas 'PointedEars' Lahn [=E2=80=A6] wrote: >>> Ian Kelly wrote: >> Why should the burden of proof be on me in the first place? > > Because *you* made the claim that =E2=80=9CSTRING+=E2=80=9D could be part= of an AST in this > way. Okay, I didn't understand before that this was the part that you were objecting to. I had written "There is only one expr node, and it contains both STRING tokens", to which you replied "Prove it." I did not intend to imply anything at all by the inclusion of STRING+ in the tree. That pseudo-tree was hastily sketched out, and as both you and Gregory have pointed out, STRING+ is not a symbol of the grammar and should not have been included as a node. None of this has any bearing on what I was trying to demonstrate with that tree. >> Within a grammar, the question of "is an X a Y" is nonsensical in >> isolation. It can only be answered in relation to a parse tree. >> Consider the simple grammar: >> >> S -> A | B >> A -> x >> B -> x >> >> Is x an A? It depends. > > No, by the definition 2 below, that we all accepted implicitly up to this > point, x is *definitely* an A. What gives you the impression that I ever accepted it? >> If the tree that generates the x produces it from an A node, then yes. >> Otherwise, no. > > Fallacy. > > First, two definitions, so that we are clear what we are talking about: > > (1) Let a *production chain* be the repeated application of the productio= n > rules of a formal grammar such that > > C =E2=87=92 D =E2=87=92 x > > is a production chain if there are production rules > > C =E2=86=92 D > D =E2=86=92 x. > > [Note the difference between =E2=80=9C=E2=87=92=E2=80=9D and =E2=80= =9C=E2=86=92=E2=80=9D.] Sure. > (2) Let the statement =E2=80=9Cx is an A=E2=80=9D be true if x can be pro= duced in a > production chain starting with or including the non-terminal A > left-hand side =E2=80=93 > > x =E2=88=88 A =E2=86=94 =E2=88=83A (=E2=80=A6 =E2=87=92 A =E2=87=92= =E2=80=A6 =E2=87=92 x). Sorry, but this definition just seems entirely arbitrary to me. Mathematically, it looks nonsensical; A is a symbol, not a set. This question of whether "x is an A" is informal and not a topic of formal language theory so far as I'm aware. Can you cite some source for it? > Now, according to these definitions, in the offered grammar x is *both* a= n A > and a B. Because what matters is _not_ the practical result of productio= n > chains (the actual parse tree), but the certainty of the theoretical > possibility of it. This strikes me as being a lot like arguing, "some kites are toys, and some kites are birds; therefore, all kites are both toys and birds." >> So when I write that the "foo" in "foo" "bar" is not an expression, I >> am only speaking in relation to the parse tree that generates "foo" >> "bar". > > But it has been indicated by others that the parse tree that you presente= d > is wrong, based on a misconception about the syntax of the formal grammar= , > and you have not yet substantiated your claim that it is correct. As noted above, the inaccuracy that Gregory pointed out has no bearing on my argument. You're really going to make me spell it out, aren't you? Fine, here you go. single_input -> simple_stmt -> expr_stmt -> testlist_star_expr -> test -> or_test -> and_test -> not_test -> comparison -> expr -> xor_expr -> and_expr -> shift_expr -> arith_expr -> term -> factor -> power -> atom -> STRING STRING Note: the derivation contains exactly one expr node, which indirectly produces both STRINGs. Neither STRING in this derivation is individually produced from the expr. >> I don't know what you mean by a "backdoor". > > Appending a statement that is contradictory to what was stated just befor= e, > or at least ambiguous, so that the possibility arises for one to say =E2= =80=9CI did > not mean that=E2=80=9D when that/a contradiction to the former statement = is pointed > out later. The purpose was not to make the possibility arise to say that. The purpose was to point out the discontinuity *immediately* so that it would be already addressed and not *need* to be pointed out later (although we can see how well that turned out). I have to say that I find it highly surprising that you find this construction objectionable. Would you still consider it "contradictory" if I had phrased it equivalently as a logical "or" rather than using the word "except"? >> The purpose of that parenthetical was to explicitly acknowledge that the >> single STRING could be viewed as an expression when taken out of context= , > > Yes, your fallacy is mainly based on ignoring the context. Context is > important; you cannot just ignore it and still make correct arguments. Funny, I thought that was my line. This whole argument came about because you seem to be stubbornly insistent on ignoring the context that I set for my statement, calling it "contradictory" instead. >> and to disclaim that I was excluding that case from the preceding >> statement. I still stand by that statement; The "foo" in "foo" "bar" is >> not an expression in the same sense that the "42" is not an expression i= n >> "hucr,.@#%c|42ptqc$". > > False analogy. The =E2=80=9C42=E2=80=9D in there cannot be produced by = =E2=80=9Cexpr=E2=80=9D *in that > context* (it can only be produced by =E2=80=9CSTRING=E2=80=9D). I apologize for the confusion. The quotation marks there were only intended to separate the nonsense construction from my own text, not as string delimiters. I realize that in the first part of the analogy I did use them as string delimiters, so I was inconsistent. The analogy to be drawn is that a parse tree of =E2=9F=A8"foo" "bar"=E2=9F= =A9 that contains an expr node for each STRING is an invalid parse, just as a parse tree of =E2=9F=A8hucr,.@#%c|42ptqc$=E2=9F=A9 that isolates =E2=9F=A84= 2=E2=9F=A9 as a single expr (or any other parse tree in this particular case) is invalid. >>> Actually, you were arguing against my statement that string literals ar= e >>> expressions (that a string literal is an expression). You claimed, >>> rather explicitly, that they were not. See above. >> >> I have no idea what point you're trying to convey here. > > Is the =E2=80=9CSee above=E2=80=9D not enough a reference? I get the connection between what you wrote here and what you wrote above. I don't get the connection between what I wrote (that has now been trimmed away) and what you wrote in response to it. My parenthetical about parsing STRINGs in isolation was not in itself an argument against what you wrote. It was in fact agreeing, within a limited context.