Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!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; 'operator': 0.03; 'syntax': 0.03; 'subject:Python': 0.05; 'python': 0.09; 'augmented': 0.09; 'indication': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'structure,': 0.09; 'terry': 0.09; 'dec': 0.15; 'agree.': 0.16; 'child.': 0.16; 'node,': 0.16; 'operator.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'shape,': 0.16; 'wrote:': 0.17; 'shape': 0.17; 'thu,': 0.17; 'typing': 0.17; 'jan': 0.18; 'saying': 0.18; 'versions': 0.20; 'sort': 0.21; 'assignment': 0.22; 'stick': 0.22; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'tree': 0.27; "doesn't": 0.28; 'header:X-Complaints-To:1': 0.28; 'argue': 0.29; 'comparison': 0.29; 'link,': 0.29; 'probably': 0.29; "i'm": 0.29; 'saves': 0.30; 'function': 0.30; 'could': 0.32; 'to:addr :python-list': 0.33; 'another': 0.33; 'pm,': 0.35; 'add': 0.36; 'received:org': 0.36; 'child': 0.36; 'visual': 0.36; 'should': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'talk': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'easily': 0.39; 'header:Received:5': 0.40; '20,': 0.65; 'afraid': 0.66; 'today': 0.67; 'believe': 0.69; 'received:fios.verizon.net': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Brython - Python in the browser Date: Thu, 20 Dec 2012 18:59:39 -0500 References: <9122ba06-bc02-42a3-84a6-568c3fab4598@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: 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: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1356048001 news.xs4all.nl 6960 [2001:888:2000:d::a6]:57804 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35241 > On Thu, Dec 20, 2012 at 8:37 PM, Pierre Quentel > wrote: >> I'm afraid I am going to disagree. The document is a tree >> structure, and today Python doesn't have a syntax for easily >> manipulating trees. What Python does have is 11 versions of the augmented assignment statement: +=, -=, *=, /=, //=, %=, **=, >>=, <<=, &=, ^=, |=. Moreover, these are *intended* to be implemented in place, by mutation, for mutable objects, with possibly class-specific meanings. >> To add a child to a node, using an operator >> instead of a function call saves a lot of typing ; We agree. Just use the proper sort of operator. I believe you said elsewhere that you *are* using one augmented assignment, +=, to add a sibling. That is a proper use. I am saying to use another to add a child. <= is a comparison expression operator, which is completely different. It is just wrong for this usage. I am 99.9% sure you will come to regret it eventually. Better to make the change now than in Brython2 or Brython3. >> <= looks like a >> left arrow, which is a visual indication of the meaning "receive as >> child". |= doesn't have this arrow shape If you want to talk shape, I could argue that you should use -= for adding a sibling (horizontal link, -) and |= for adding a child (vertical link, |). Since you probably want to stick with += and like the 'arrowness' of <=, use the augmented assignment operator <<= instead of comparison operator <=. -- Terry Jan Reedy