Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'syntax': 0.03; 'subject:Python': 0.05; 'that?': 0.05; '21,': 0.07; 'append': 0.07; 'interpreter,': 0.09; 'operator,': 0.09; 'dec': 0.15; 'confusion': 0.16; 'element.': 0.16; 'keyword,': 0.16; 'lhs': 0.16; 'nodes': 0.16; 'nodes.': 0.16; 'string': 0.17; 'wrote:': 0.17; 'module': 0.19; 'trying': 0.21; 'doc': 0.22; 'header:In- Reply-To:1': 0.25; 'looks': 0.26; 'am,': 0.27; 'guess': 0.27; 'message-id:@mail.gmail.com': 0.27; 'comparison': 0.29; 'case,': 0.29; 'probably': 0.29; 'maybe': 0.29; 'usually': 0.30; 'attach': 0.30; 'framework': 0.30; 'fri,': 0.30; 'expect': 0.31; 'point': 0.31; 'could': 0.32; 'point,': 0.33; 'to:addr:python-list': 0.33; 'another': 0.33; 'received:google.com': 0.34; 'wrong': 0.34; 'doing': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'add': 0.36; 'but': 0.36; 'child': 0.36; 'should': 0.36; 'possible': 0.37; 'itself': 0.37; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'nothing': 0.38; 'sure': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'think': 0.40; "you've": 0.61; 'is.': 0.62; 'more': 0.63; 'treat': 0.65; 'obvious': 0.71; '99.9%': 0.84; 'to:name:python': 0.84; 'regret': 0.91 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=XX5wJScc+9VIR/JTzco42kCN9Vox1zA1k4rX5HRFQQU=; b=UtLLY2/DVljOubBZwfcqK2F0+vtzUwph/gxnOYu+lhin1EdF9IjnSE34ZbTqzJlpAU 4DbCo+qn3yFJcDwlC+QrpY+ZHY6BN00+rKmnIIDtD11I3v/gW/1YUxAjkgrJHVjGP00z unid9c/IzOAZ+K5XNbIQCIlZ5T2jGyjxIPaATdMoDHOnEC/ixc8IReRhuhpvOtqM1kMM bh7L55wZz7zO8GtYGmj8ldVm+1zuRBpU6/9vHHjb2jKSN7/PBDCMlvFPVWlOc8lgNI0r 16JeYjVwIrEJZmlY//pfKJOZ1wJdTI2dPd/YBbJqBWfduHk4TN+8VjcTS6FD04mSx5Wj QxXw== MIME-Version: 1.0 In-Reply-To: References: <9122ba06-bc02-42a3-84a6-568c3fab4598@googlegroups.com> From: Ian Kelly Date: Fri, 21 Dec 2012 11:31:11 -0700 Subject: Re: Brython - Python in the browser To: Python Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 1356114705 news.xs4all.nl 6881 [2001:888:2000:d::a6]:39100 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35313 On Fri, Dec 21, 2012 at 9:16 AM, Pierre Quentel wrote: >> <=3D 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 Brython= 3. > > I am 99.99% sure of the contrary, having used this syntax for more than 3= years now, as the users of the Karrigell framework with the HTMLTags modul= e > > Another point why there is no possible confusion is that when <=3D is a c= omparison operator, it is never used in an standalone expression like "a <= =3D b", with the left term of the comparison starting the line ; it is alwa= ys used in an expression like "if x <=3D 10", "while x <=3D 5", "assert x <= =3D 0", "return foo <=3D bar" etc. > > So when you see a line like > > doc <=3D DIV('hello') > > it should be obvious that you are not *comparing* doc and DIV('hello'), b= ecause if it was the case, the line would do nothing 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. 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()?