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; 'python,': 0.02; 'operator': 0.03; 'syntax': 0.03; 'interpreter': 0.04; 'subject:Python': 0.05; 'javascript,': 0.07; 'level,': 0.07; 'python': 0.09; '"or': 0.09; 'clock,': 0.09; 'indication': 0.09; 'interpreter,': 0.09; 'scripting': 0.09; 'structure,': 0.09; 'subset': 0.09; 'target,': 0.09; 'terry': 0.09; 'to:addr:comp.lang.python': 0.09; 'worse': 0.09; 'cc:addr:python- list': 0.10; ';-)': 0.11; 'programmer': 0.11; 'language': 0.14; '(like': 0.15; 'dictionaries': 0.16; 'element,': 0.16; 'elsewhere,': 0.16; 'node,': 0.16; 'non-empty': 0.16; 'numpy': 0.16; 'presume': 0.16; 'py3': 0.16; 'reedy': 0.16; 'splits': 0.16; 'unnecessary.': 0.16; 'unordered': 0.16; 'translation': 0.16; 'wrote:': 0.17; 'instance': 0.17; 'instance,': 0.17; 'shape': 0.17; 'specify': 0.17; 'typing': 0.17; 'creates': 0.18; 'jan': 0.18; 'obviously': 0.18; 'translate': 0.20; 'mostly': 0.20; 'tracker': 0.20; 'doc': 0.22; 'latter': 0.22; 'tuples': 0.22; 'defined': 0.22; 'cc:2**0': 0.23; 'sets': 0.23; 'statement': 0.23; 'cc:no real name:2**0': 0.24; 'connected': 0.24; 'feature': 0.24; 'script': 0.24; 'least': 0.25; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'looks': 0.26; 'url:wiki': 0.26; 'supported': 0.26; 'compiled': 0.27; 'forgive': 0.27; 'replace': 0.27; 'translated': 0.27; 'tree': 0.27; "doesn't": 0.28; 'allowed,': 0.29; 'arrays': 0.29; 'changed.': 0.29; 'comparison': 0.29; 'omitted': 0.29; 'unlikely': 0.29; 'url:wikipedia': 0.29; 'usable': 0.29; 'array': 0.29; "i'm": 0.29; 'related': 0.30; 'classes': 0.30; "skip:' 10": 0.30; 'that.': 0.30; 'saves': 0.30; 'function': 0.30; 'error': 0.30; 'sense': 0.31; 'lists': 0.31; 'code': 0.31; 'point': 0.31; 'url:python': 0.32; 'could': 0.32; 'says': 0.33; 'true.': 0.33; 'changed': 0.34; 'received:google.com': 0.34; 'wrong': 0.34; 'done': 0.34; 'list': 0.35; 'needed': 0.35; 'false': 0.35; 'machines': 0.35; 'pm,': 0.35; 'similar': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'add': 0.36; 'created': 0.36; 'except': 0.36; 'but': 0.36; 'url:org': 0.36; 'child': 0.36; 'visual': 0.36; 'should': 0.36; 'too': 0.36; 'skip:p 20': 0.36; 'possible': 0.37; 'ok,': 0.37; 'does': 0.37; 'two': 0.37; 'being': 0.37; 'virtual': 0.37; 'received:209': 0.37; 'different': 0.63; 'show': 0.63; 'visit': 0.64; 'making': 0.64; 'anchor': 0.65; 'stuck': 0.65; 'afraid': 0.66; 'home': 0.66; 'today': 0.67; 'url:%1': 0.68; 'lack': 0.71; 'sounds': 0.71; 'browser.': 0.81; 'ambition': 0.84; 'browsers,': 0.84; 'cognitive': 0.84; 'dict()': 0.84; 'different.': 0.84; 'off"': 0.84; 'pyjs,': 0.84; 'engines.': 0.91; 'urge': 0.91; 'mystery': 0.95 Newsgroups: comp.lang.python Date: Thu, 20 Dec 2012 01:37:49 -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: 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-list@python.org 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: 178 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1356002100 news.xs4all.nl 6973 [2001:888:2000:d::a6]:34361 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35188 Le jeudi 20 d=E9cembre 2012 01:07:15 UTC+1, Terry Reedy a =E9crit=A0: > On 12/19/2012 1:19 PM, Pierre Quentel wrote: >=20 >=20 >=20 > > The objective of Brython is to replace Javascript by Python as the >=20 > > scripting language for web browsers, making it usable on all >=20 > > terminals including smartphones, tablets, connected TVs, etc. Please >=20 > > forgive the lack of ambition ;-) >=20 >=20 >=20 > This sounds similar to pyjs, but the latter has two big problems: a)=20 >=20 > personality conflicts splits among the developers; b) last I knew, it=20 >=20 > was stuck on Python 2. >=20 It is indeed different from pyjs : both translate Python into Javascript, b= ut with Brython the translation is done on the fly by the browser, with pyj= s is is done once by a Python script >=20 >=20 > I think your home page/doc/announcement should specify Python 3 at the=20 >=20 > top, so it is not a mystery until one reads down to >=20 > "Brython supports most keywords and functions of Python 3 : " >=20 Done on the home page >=20 >=20 > "lists are created with [] or list(), tuples with () or tuple(),=20 >=20 > dictionaries with {} or dict() and sets with set()" >=20 >=20 >=20 > non-empty sets are also created with {} and you should support that. >=20 Ok, I put this point in the issue tracker >=20 >=20 > > The best introduction is to visit the Brython site >=20 > > (http://www.brython.info). >=20 >=20 >=20 > That says that my browser, Firefox 17, does not support HTML5. Golly=20 >=20 > gee. I don't think any browser support5 all of that moving target, and=20 >=20 > Gecko 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=20 >=20 > needed for the clock, but then the page should say just that. Has the=20 >=20 > latest FF (17) actually been tested? >=20 I changed the error message adding "or Javascript is turned off" >=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 > '<=3D' is not just an operator, it is a comparison operator. It normally= =20 >=20 > return False or True. Numpy array comparison returns arrays of booleans,= =20 >=20 > so the meaning is extended, not completely changed. People will often be= =20 >=20 > using it with its normal mean in conditionals elsewhere, so this usage=20 >=20 > creates strong cognitive dissonance. Also, using an expression as a=20 >=20 > statement is allowed, but except in the interactive interpreter, it only= =20 >=20 > makes sense with an expression that obviously has side-effects or could= =20 >=20 > have side-effects (like the expression 'mylist.sort()'. It just looks=20 >=20 > wrong to an experienced Python programmer like me. >=20 >=20 >=20 > It also is unnecessary. Use '+=3D' or '|=3D'. The former means just what = you=20 >=20 > want the statement to do and the latter is at least somewhat related=20 >=20 > (bit or-addition) and is rarely used and is very unlikely to be used in= =20 >=20 > code intended for a browser. >=20 >=20 I'm afraid I am going to disagree. The document is a tree structure, and to= day Python doesn't have a syntax for easily manipulating trees. To add a ch= ild to a node, using an operator instead of a function call saves a lot of = typing ; <=3D looks like a left arrow, which is a visual indication of the = meaning "receive as child". |=3D doesn't have this arrow shape +=3D is supported by Brython, but it means something different. <=3D means = "add child" ; the addition operator + means "add brother" For instance, d =3D UL(LI('test1')) d +=3D UL(LI('test2')) doc <=3D d will show two unordered lists at the same level, while =20 d =3D UL(LI('test1')) d <=3D UL(LI('test2')) doc <=3D d will nest the second list inside the first one In fact, even in CPython there could be a built-in tree class that could be= managed by a syntax such as this one >=20 >=20 >=20 > > It still lacks important features of Python, mostly list >=20 > > comprehensions and classes ; >=20 >=20 >=20 > Since Python 3 has 4 types of comprehensions, while Python 2 only has=20 >=20 > list comprehensions, I took this to mean that Brython was Python 2. >=20 >=20 >=20 > And yes, I am all in favor of being able to use a subset of Py3 instead= =20 >=20 > of javascript. A full Python interpreter in a browser is too dangerous.= =20 >=20 > (Actually, I think javascript is too, but that is a different issue.)=20 >=20 > Python translated to javascript cannot be worse than javascript. I=20 >=20 > presume the same would be true if the javascript step were omitted and=20 >=20 > Python were directly compiled to the virtual machines defined by current= =20 >=20 > javascript engines. >=20 >=20 >=20 > --=20 >=20 > Terry Jan Reedy