Path: csiph.com!usenet.pasdenom.info!aioe.org!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; 'api.': 0.04; 'subject:Python': 0.05; 'cpython': 0.05; 'debugging': 0.05; 'javascript,': 0.07; 'matches': 0.07; 'api': 0.09; 'python': 0.09; 'abstraction': 0.09; 'clock,': 0.09; 'higher-level': 0.09; 'methods,': 0.09; 'subset': 0.09; 'target,': 0.09; 'terry': 0.09; 'to:addr:comp.lang.python': 0.09; 'bug': 0.10; 'cc:addr:python- list': 0.10; 'suggest': 0.11; 'do,': 0.15; 'dec': 0.15; '+1.': 0.16; 'barrier': 0.16; 'bytecode': 0.16; 'constructs': 0.16; 'element,': 0.16; 'fancy': 0.16; 'iteration': 0.16; 'low-level': 0.16; 'reedy': 0.16; 'similarly,': 0.16; 'syntax,': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'instance': 0.17; 'equivalent': 0.20; 'do.': 0.21; 'supposed': 0.21; 'doc': 0.22; 'runs': 0.22; 'cc:2**0': 0.23; 'mention': 0.23; 'idea': 0.24; 'feature': 0.24; 'allows': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '(which': 0.26; 'url:wiki': 0.26; 'library.': 0.27; "doesn't": 0.28; 'actual': 0.28; 'dom': 0.29; 'inspect': 0.29; 'mind,': 0.29; 'obscure': 0.29; 'optional': 0.29; 'url:wikipedia': 0.29; "i'm": 0.29; 'that.': 0.30; 'expect': 0.31; 'code': 0.31; 'point': 0.31; 'asking': 0.32; 'url:python': 0.32; 'switch': 0.32; 'certain': 0.33; 'says': 0.33; '"")': 0.33; 'skip:d 20': 0.34; 'received:google.com': 0.34; 'along': 0.35; 'clear': 0.35; 'needed': 0.35; 'described': 0.35; 'mine': 0.35; 'stable': 0.35; 'pm,': 0.35; 'continue': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'but': 0.36; 'url:org': 0.36; 'programmers': 0.36; 'should': 0.36; 'enough': 0.36; 'possible': 0.37; 'does': 0.37; 'option': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'skip:l 20': 0.38; 'supports': 0.38; 'some': 0.38; 'possible.': 0.38; 'url:en': 0.38; 'page': 0.38; 'instead': 0.39; 'build': 0.39; 'application': 0.40; 'where': 0.40; 'think': 0.40; 'link': 0.60; 'lower': 0.61; 'map': 0.61; 'latest': 0.61; 'back': 0.62; 'close': 0.63; 'more': 0.63; 'offer': 0.65; 'anchor': 0.65; 'url:%1': 0.68; 'benefit': 0.70; 'calls,': 0.84; 'clearer': 0.84; 'construct': 0.84; 'received:209.85.213.184': 0.91; 'urge': 0.91 Newsgroups: comp.lang.python Date: Thu, 20 Dec 2012 01:42:01 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=193.49.124.107; posting-account=cEyVOAoAAAAQ26Zg5AgQClqyybEKp-yz References: <50D256B3.4070709@udel.edu> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 193.49.124.107 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: 106 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1355999272 news.xs4all.nl 6988 [2001:888:2000:d::a6]:54426 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35187 Le jeudi 20 d=E9cembre 2012 01:54:44 UTC+1, Ian a =E9crit=A0: > On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy wrote: >=20 > > That says that my browser, Firefox 17, does not support HTML5. Golly ge= e. I >=20 > > don't think any browser support5 all of that moving target, and Gecko >=20 > > apparently supports about as large a subset as most. >=20 > > https://en.wikipedia.org/wiki/Comparison_of_layout_engines_%28HTML5%29 >=20 > > It is possible the FF still does not support the particular feature nee= ded >=20 > > for the clock, but then the page should say just that. Has the latest F= F >=20 > > (17) actually been tested? >=20 >=20 >=20 > It works for me using FF 17.0.1. >=20 >=20 >=20 > >> To create an element, for instance an HTML anchor : >=20 > >> doc <=3D A('Python',href=3D"http://www.python.org") >=20 > > >=20 > > >=20 > > To me, that is a awful choice and I urge you to change it. >=20 >=20 >=20 > +1. The DOM already has a well-established API. The following may >=20 > require more typing: >=20 >=20 >=20 > link =3D document.createElement('a') >=20 > link.setAttribute("href", "http://www.python.org/") >=20 > link.appendChild(document.createTextNode('Python')) >=20 > document.body.appendChild(link) >=20 >=20 >=20 > But it is much clearer in intent. Since these methods map directly to >=20 > DOM methods, I know exactly what I expect them to do, and I can look >=20 > them up in the browser documentation if I have any doubts. With the >=20 > one-liner above, I don't know exactly what that maps to in actual DOM >=20 > calls, and so I'm a lot less clear on what exactly it is supposed to >=20 > do. I'm not even entirely certain whether it's actually equivalent to >=20 > my code above. >=20 >=20 >=20 > I suggest that Brython should have a "low-level" DOM API that matches >=20 > up to the actual DOM in as close to a 1:1 correspondence as possible. >=20 > Then if you want to have a higher-level API that allows whiz-bang >=20 > one-liners like the above, build it as an abstraction on top of the >=20 > low-level API and include it as an optional library. This has the >=20 > added benefit that if the user runs into an obscure bug where the >=20 > fancy API breaks on some particular operation on some specific >=20 > browser, they will still have the option of falling back to the >=20 > low-level API to work around it. It would also make the conversion >=20 > barrier much lower for web programmers looking to switch to Brython, >=20 > if they can continue to use the constructs that they're already >=20 > familiar with but just write them in Python instead of JavaScript. We don't have the same point of view. Mine is to offer an alternative to Ja= vascript, with the simplicity and elegance of the Python syntax, for a prog= ramer who wants to develop a web application and doesn't know Javascript. U= ltimately this means that the whole DOM API would be described without any = mention of Javascript, only with the Python API With this idea in mind, asking Brython to have a Javascript-like low-level = API is like asking CPython to support iteration with a low-level construct = like "for i=3D0;i<10;i++" along with "for i in range(10)". The Python engin= e is stable enough that we don't have to inspect the bytecode for debugging= ; similarly, when Brython is mature enough, you won't have to look at the = generated Javascript code (which you can do though, eg in the console)