Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; 'that?': 0.05; 'append': 0.07; '(it': 0.09; 'interpreter,': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'cases': 0.15; 'element.': 0.16; 'keyword,': 0.16; 'lhs': 0.16; 'nodes': 0.16; 'nodes.': 0.16; 'translation': 0.16; 'string': 0.17; 'trying': 0.21; 'doc': 0.22; 'cc:2**0': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'looks': 0.26; 'guess': 0.27; 'received:209.85.212': 0.28; 'comparison': 0.29; 'dom': 0.29; 'node': 0.29; 'obj': 0.29; 'represented': 0.29; 'probably': 0.29; 'class': 0.29; 'maybe': 0.29; 'usually': 0.30; 'attach': 0.30; 'expect': 0.31; 'code': 0.31; 'could': 0.32; 'anywhere': 0.33; 'point,': 0.33; 'another': 0.33; 'received:google.com': 0.34; 'adds': 0.35; 'doing': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'add': 0.36; 'explain': 0.36; 'but': 0.36; 'child': 0.36; 'depends': 0.36; 'itself': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'several': 0.39; 'instead': 0.39; 'think': 0.40; 'skip:u 10': 0.60; "you've": 0.61; 'is.': 0.62; 'more': 0.63; 'treat': 0.65; 'tree,': 0.84 Newsgroups: comp.lang.python Date: Fri, 21 Dec 2012 12:59:19 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2.2.8.199; posting-account=cEyVOAoAAAAQ26Zg5AgQClqyybEKp-yz References: <9122ba06-bc02-42a3-84a6-568c3fab4598@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 2.2.8.199 MIME-Version: 1.0 Subject: Re: Brython - Python in the browser From: Pierre Quentel To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Python 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1356123569 news.xs4all.nl 6886 [2001:888:2000:d::a6]:46600 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35318 > The interpreter, though, will be more than happy to treat that as a > comparison if the LHS is not the type that you think it is. For > example, maybe you've added it to a string at some point, and now it's > a string instead of an element. I guess that since doc is made a > keyword, that probably couldn't happen in this example, but it could > happen when trying to add child nodes to other nodes. Unsurprisingly, the translation engine in Brython transforms x <=3D y into = x.__le__(y) If x is a string, then __le__ means of course "lesser or equal" so y can on= ly be a string, otherwise an exception is raised ; this is similar to tryin= g to add a child node to a text node in the DOM > By the way, what is Brython actually doing when you append a child to > the document itself like that? Usually I would expect a div to be > appended to the body or to another div. The above looks like it would > attach the new div as a sibling of the html element. Or is it just > calling document.write()? dom_elt <=3D obj actually adds one or several DOM nodes (it depends of the = class of obj) to the DOM node represented by dom_elt. It's difficult to exp= lain all the cases here, you would have to take a look at the code in py_do= m.js, but <=3D and + work on the DOM tree, there is no document.write anywh= ere