Re: Brython (Python in the browser)

2013-12-27 Thread billy . earney
Awesome.. Wonderful work! -- https://mail.python.org/mailman/listinfo/python-list

Re: Brython (Python in the browser)

2013-12-27 Thread Pierre Quentel
Le vendredi 27 décembre 2013 17:12:09 UTC+1, Johannes Schneider a écrit : > On 27.12.2013 07:14, Pierre Quentel wrote: > > > Hi, > > > > > > Ever wanted to use Python instead of Javascript for web client programming > > ? Take a look at Brython, an implementation of Python 3 in the browser, >

Re: Brython (Python in the browser)

2013-12-27 Thread Pierre Quentel
Le vendredi 27 décembre 2013 15:56:33 UTC+1, jonas.t...@gmail.com a écrit : > Den fredagen den 27:e december 2013 kl. 07:14:35 UTC+1 skrev Pierre Quentel: > > > Hi, > > > > > > > > > > > > Ever wanted to use Python instead of Javascript for web client programming > > ? Take a look at Bryth

Re: Brython (Python in the browser)

2013-12-27 Thread Johannes Schneider
On 27.12.2013 07:14, Pierre Quentel wrote: Hi, Ever wanted to use Python instead of Javascript for web client programming ? Take a look at Brython, an implementation of Python 3 in the browser, with an interface with DOM elements and events Its use is very simple : - load the Javascript libra

Re: Brython (Python in the browser)

2013-12-27 Thread jonas . thornvall
Den fredagen den 27:e december 2013 kl. 07:14:35 UTC+1 skrev Pierre Quentel: > Hi, > > > > Ever wanted to use Python instead of Javascript for web client programming ? > Take a look at Brython, an implementation of Python 3 in the browser, with an > interface with DOM elements and events > >

Re: Brython (Python in the browser)

2013-12-27 Thread Roy Smith
In article <234a1a8d-e491-4eec-8bd5-7931cf4f7...@googlegroups.com>, Pierre Quentel wrote: > Hi, > > Ever wanted to use Python instead of Javascript for web client programming ? > Take a look at Brython, an implementation of Python 3 in the browser, with an > interface with DOM elements and ev

Brython (Python in the browser)

2013-12-26 Thread Pierre Quentel
Hi, Ever wanted to use Python instead of Javascript for web client programming ? Take a look at Brython, an implementation of Python 3 in the browser, with an interface with DOM elements and events Its use is very simple : - load the Javascript library brython.js :

Re: Brython - Python in the browser

2012-12-22 Thread Chris Angelico
On Sun, Dec 23, 2012 at 7:31 AM, Dan Sommers wrote: > On Sat, 22 Dec 2012 23:11:00 +1100, Chris Angelico wrote: > >> "This is a string" / 3 ==> ["This ", "is a ", "strin", "g"] >> and "This is a string" // 3 ==> ["This ", "is a ", "strin"] >> then "This is a string" % 3 ==> ["g"] or possibly "g" >

Re: Brython - Python in the browser

2012-12-22 Thread Ian Kelly
On Sat, Dec 22, 2012 at 1:31 PM, Dan Sommers wrote: > So why are we all so comfortable with using "*" as the operator for > multiplication? I'm sure that a new programming language that dared to > use U+00D7 or U+2715 for multiplication would be instantly rejected on > the grounds that it was con

Re: Brython - Python in the browser

2012-12-22 Thread Dan Sommers
On Sat, 22 Dec 2012 23:11:00 +1100, Chris Angelico wrote: > "This is a string" / 3 ==> ["This ", "is a ", "strin", "g"] > and "This is a string" // 3 ==> ["This ", "is a ", "strin"] > then "This is a string" % 3 ==> ["g"] or possibly "g" > > which is incompatible with current usage. But that's a

Re: Brython - Python in the browser

2012-12-22 Thread Chris Angelico
On Sat, Dec 22, 2012 at 10:05 PM, Steven D'Aprano wrote: > On Sat, 22 Dec 2012 20:08:25 +1100, Chris Angelico wrote: > >> I don't see "string % tuple" as a good syntax; I prefer to spell it >> sprintf("format",arg,arg,arg). > > Very possibly one of the worst names ever from a language that excels

Re: Brython - Python in the browser

2012-12-22 Thread Steven D'Aprano
On Sat, 22 Dec 2012 20:08:25 +1100, Chris Angelico wrote: > I don't see "string % tuple" as a good syntax; I prefer to spell it > sprintf("format",arg,arg,arg). Very possibly one of the worst names ever from a language that excels at bad names. "Sprint f"? WTF? Certainly not appropriate for Py

Re: Brython - Python in the browser

2012-12-22 Thread Chris Angelico
On Sat, Dec 22, 2012 at 7:54 PM, Pierre Quentel wrote: >> Still, it tends to be a lot harder to explain, document, and read >> documentation for, something that uses operators weirdly, rather than >> keyword-searchable method names. > > You don't explain how to use the Python syntax (for instance

Re: Brython - Python in the browser

2012-12-22 Thread Pierre Quentel
I forgot to mention : list comprehensions and the ternary operator (r1 if cond else r2) are now supported ! - Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Brython - Python in the browser

2012-12-22 Thread Pierre Quentel
> Still, it tends to be a lot harder to explain, document, and read > documentation for, something that uses operators weirdly, rather than > keyword-searchable method names. You don't explain how to use the Python syntax (for instance the operator %, which behaves very differently between intege

Re: Brython - Python in the browser

2012-12-22 Thread Chris Angelico
On Sat, Dec 22, 2012 at 6:57 PM, Pierre Quentel wrote: > I was over-simplifying - or, to put is less diplomatically, I screwed up - > when I answered that the addition returned a string. As Chris pointed out, it > made the explanation very confusing. My apologies > > The objects handled by + and

Re: Brython - Python in the browser

2012-12-22 Thread Pierre Quentel
I was over-simplifying - or, to put is less diplomatically, I screwed up - when I answered that the addition returned a string. As Chris pointed out, it made the explanation very confusing. My apologies The objects handled by + and <= can be : - strings, integers, floats - instances of $TagClass

Re: Brython - Python in the browser

2012-12-22 Thread Pierre Quentel
> Oh, and repr is just a synonym of str, which makes it useless. 3 days ago repr was not even implemented at all, so it's a step forward... -- http://mail.python.org/mailman/listinfo/python-list

Re: Brython - Python in the browser

2012-12-21 Thread Steven D'Aprano
On Fri, 21 Dec 2012 12:25:01 +0100, Stefan Behnel wrote: > If that's your intention, then instead of coming up with something > totally new, unpythonic and ugly, why not take the normal Python route > and implement a subset of the ElementTree API? Yo mean something old, unpythonic and ugly? :-P

Re: Brython - Python in the browser

2012-12-21 Thread Chris Angelico
On Sat, Dec 22, 2012 at 10:50 AM, Amirouche Boubekki wrote: > Last time I checked DOM > manipulation is not the primary way for js devs to do DOM manipulation > anymore, or is it ? Javascript template engines do DOM manipulation but this > is almost invisible for the user... Not sure how most of

Re: Brython - Python in the browser

2012-12-21 Thread Chris Angelico
On Sat, Dec 22, 2012 at 10:57 AM, Ian Kelly wrote: > From the code, it appears that adding two nodes together *actually* > returns a $AbstractTag object, which seems to be just a container for > a list of child nodes with no parent, that automagically gets removed > from the hierarchy when appende

Re: Brython - Python in the browser

2012-12-21 Thread Ian Kelly
On Fri, Dec 21, 2012 at 4:45 PM, Ian Kelly wrote: > In my playing around with it just now, the addition doesn't seem to > actually return a string. >From the code, it appears that adding two nodes together *actually* returns a $AbstractTag object, which seems to be just a container for a list of

Re: Brython - Python in the browser

2012-12-21 Thread Ian Kelly
On Fri, Dec 21, 2012 at 4:45 PM, Ian Kelly wrote: > In Brython, the str builtin does not return strings? Oh, and repr is just a synonym of str, which makes it useless. -- http://mail.python.org/mailman/listinfo/python-list

Re: Brython - Python in the browser

2012-12-21 Thread Amirouche Boubekki
Héllo, > > doc <= 'blah blah x I will surely backlog latter or some crytologist from the futur will do and he will surely agree about the fact something strange happened around december 2012. Sorry for that, that's me trying to be funny. Last time I checked DOM manipulation is not the primary w

Re: Brython - Python in the browser

2012-12-21 Thread Ian Kelly
On Fri, Dec 21, 2012 at 3:52 PM, Chris Angelico wrote: > On Sat, Dec 22, 2012 at 3:36 AM, Pierre Quentel > wrote: >> >>> Hmm. So when that gets added into a DIV, it has to get parsed for >>> tags? How does this work? This seems very odd. I would have expected >>> it to remain as DOM objects. >> >

Re: Brython - Python in the browser

2012-12-21 Thread Chris Angelico
On Sat, Dec 22, 2012 at 3:36 AM, Pierre Quentel wrote: > >> Hmm. So when that gets added into a DIV, it has to get parsed for >> tags? How does this work? This seems very odd. I would have expected >> it to remain as DOM objects. > > In DIV(child) : > - if child is a string, integer or float, a te

Re: Brython - Python in the browser

2012-12-21 Thread Ian Kelly
On Fri, Dec 21, 2012 at 1:59 PM, Pierre Quentel wrote: >> 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

Re: Brython - Python in the browser

2012-12-21 Thread Pierre Quentel
> 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 proba

Re: Brython - Python in the browser

2012-12-21 Thread Ian Kelly
On Fri, Dec 21, 2012 at 9:16 AM, Pierre Quentel wrote: >> <= 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. > > I am 99.99%

Re: Brython - Python in the browser

2012-12-21 Thread Stefan Behnel
Pierre Quentel, 21.12.2012 17:16: > So when you see a line like > > doc <= DIV('hello') > > it should be obvious that you are not *comparing* doc and DIV('hello'), > because if it was the case, the line would do nothing Yep, that's one of the main concerns - it looks like useless code, which is

Re: Brython - Python in the browser

2012-12-21 Thread Pierre Quentel
> Hmm. So when that gets added into a DIV, it has to get parsed for > tags? How does this work? This seems very odd. I would have expected > it to remain as DOM objects. In DIV(child) : - if child is a string, integer or float, a text node is added (addChild) to the DIV element, with the string

Re: Brython - Python in the browser

2012-12-21 Thread Pierre Quentel
> <= 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. I am 99.99% sure of the contrary, having used this syntax for more than

Re: Brython - Python in the browser

2012-12-21 Thread Chris Angelico
On Sat, Dec 22, 2012 at 2:36 AM, Pierre Quentel wrote: >> doc.add(Tag('DIV').add('hello ').add(Tag('B').add('world'))) >> > No, with this syntax, the result of Tag('B').add('world') is below 'hello' in > the tree structure, not at the same level (just below Tag('DIV')) as it > should be No; loo

Re: Brython - Python in the browser

2012-12-21 Thread Pierre Quentel
> Pythonic also means: > If the implementation is hard to explain, it's a bad idea. > What, exactly, does the sum of a string and a bolded string produce? Can you > explain that easily and clearly? Yes : a+b returns the string a+str(b) It is exactly what you get in CPython with >>> class B: ..

Re: Brython - Python in the browser

2012-12-21 Thread Stefan Behnel
Duncan Booth, 21.12.2012 14:14: > Pierre Quentel wrote: >>> If that's your intention, then instead of coming up with something >>> totally new, unpythonic and ugly, why not take the normal Python >>> route and implement a subset of the ElementTree API? >> >> Because the tree implementation in Eleme

Re: Brython - Python in the browser

2012-12-21 Thread Duncan Booth
Pierre Quentel wrote: >> If that's your intention, then instead of coming up with something >> totally new, unpythonic and ugly, why not take the normal Python >> route and implement a subset of the ElementTree API? >> >> Stefan > Because the tree implementation in ElementTree or other tree modu

Re: Brython - Python in the browser

2012-12-21 Thread Chris Angelico
On Fri, Dec 21, 2012 at 11:38 PM, Pierre Quentel wrote: > With the tree syntax proposed in Brython it would just be > > doc <= DIV('hello '+B('world')) > > If "pythonic" means concise and readable, which one is more pythonic ? Pythonic also means: If the implementation is hard to explain, it's a

Re: Brython - Python in the browser

2012-12-21 Thread Pierre Quentel
> If that's your intention, then instead of coming up with something totally > new, unpythonic and ugly, why not take the normal Python route and > implement a subset of the ElementTree API? > > Stefan Because the tree implementation in ElementTree or other tree modules in Python require a lot of

Re: Brython - Python in the browser

2012-12-21 Thread Stefan Behnel
Pierre Quentel, 20.12.2012 10:42: > Le jeudi 20 décembre 2012 01:54:44 UTC+1, Ian a écrit : >> On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy wrote: To create an element, for instance an HTML anchor : doc <= A('Python',href="http://www.python.org";) >>> >>> To me, that is a awful choice and

Re: Brython - Python in the browser

2012-12-21 Thread Terry Reedy
On 12/21/2012 3:31 AM, Rouslan Korneychuk wrote: Although I'm not really in favor of using an operator for this sort of thing either way, I can't help but notice the discussion seems to be limited to Python's operators. If you're implementing Python yourself, can't you define a new operator that

Re: Brython - Python in the browser

2012-12-21 Thread Rouslan Korneychuk
On 12/20/2012 04:37 AM, Pierre Quentel wrote: To create an element, for instance an HTML anchor : doc <= A('Python',href="http://www.python.org";) To me, that is a awful choice and I urge you to change it. '<=' is not just an operator, it is a comparison operator. It normally return False or

Re: Brython - Python in the browser

2012-12-20 Thread Chris Angelico
On Fri, Dec 21, 2012 at 1:05 PM, Steven D'Aprano wrote: > On Thu, 20 Dec 2012 18:59:39 -0500, Terry Reedy wrote: >> What Python does have is 11 versions of the augmented assignment >> statement: +=, -=, *=, /=, //=, %=, **=, >>=, <<=, &=, ^=, |=. Moreover, >> these are *intended* to be implemented

Re: Brython - Python in the browser

2012-12-20 Thread Steven D'Aprano
On Thu, 20 Dec 2012 18:59:39 -0500, Terry Reedy wrote: >> 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 v

Re: Brython - Python in the browser

2012-12-20 Thread Terry Reedy
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: +=, -=, *=, /=, //=,

Re: Brython - Python in the browser

2012-12-20 Thread Jamie Paul Griffin
* Ian Kelly [2012-12-19 17:54:44 -0700]: > On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy wrote: > > That says that my browser, Firefox 17, does not support HTML5. Golly gee. I > > don't think any browser support5 all of that moving target, and Gecko > > apparently supports about as large a subset

Re: Brython - Python in the browser

2012-12-20 Thread Chris Angelico
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. To add a > child to a node, using an operator instead of a function call saves a lot of > typing

Re: Brython - Python in the browser

2012-12-20 Thread Pierre Quentel
Le jeudi 20 décembre 2012 01:54:44 UTC+1, Ian a écrit : > On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy wrote: > > > That says that my browser, Firefox 17, does not support HTML5. Golly gee. I > > > don't think any browser support5 all of that moving target, and Gecko > > > apparently supports a

Re: Brython - Python in the browser

2012-12-20 Thread Pierre Quentel
Le jeudi 20 décembre 2012 01:07:15 UTC+1, Terry Reedy a écrit : > On 12/19/2012 1:19 PM, Pierre Quentel wrote: > > > > > The objective of Brython is to replace Javascript by Python as the > > > scripting language for web browsers, making it usable on all > > > terminals including smartphones,

Re: Brython - Python in the browser

2012-12-19 Thread Terry Reedy
On 12/19/2012 7:54 PM, Ian Kelly wrote: On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy wrote: That says that my browser, Firefox 17, does not support HTML5. Golly gee. I don't think any browser support5 all of that moving target, and Gecko apparently supports about as large a subset as most. http

Re: Brython - Python in the browser

2012-12-19 Thread Ian Kelly
On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy wrote: > That says that my browser, Firefox 17, does not support HTML5. Golly gee. I > don't think any browser support5 all of that moving target, and Gecko > apparently supports about as large a subset as most. > https://en.wikipedia.org/wiki/Compariso

Re: Brython - Python in the browser

2012-12-19 Thread Terry Reedy
On 12/19/2012 1:19 PM, Pierre Quentel wrote: The objective of Brython is to replace Javascript by Python as the scripting language for web browsers, making it usable on all terminals including smartphones, tablets, connected TVs, etc. Please forgive the lack of ambition ;-) This sounds similar

Re: Brython - Python in the browser

2012-12-19 Thread jkn
Hi Pierre this looks very interesting, thanks. But I wonder ... do you know of pyjs (pyjamas as-was)? http://pyjs.org/ I would be interested in a comparison between (the aims of) Brython and pyjs. Either way, thanks for the info. Regards Jon N -- http://mail.python.org/mailman/list

Brython - Python in the browser

2012-12-19 Thread Pierre Quentel
Hi, The objective of Brython is to replace Javascript by Python as the scripting language for web browsers, making it usable on all terminals including smartphones, tablets, connected TVs, etc. Please forgive the lack of ambition ;-) The best introduction is to visit the Brython site (http://w