Re: Brython (Python in the browser)

2013-12-27 Thread Roy Smith
In article 234a1a8d-e491-4eec-8bd5-7931cf4f7...@googlegroups.com, Pierre Quentel pierre.quen...@gmail.com 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

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 Its

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

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 Brython, an

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, with an

Re: Brython (Python in the browser)

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

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 : script

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-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 Chris Angelico
On Sat, Dec 22, 2012 at 6:57 PM, Pierre Quentel pierre.quen...@gmail.com 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

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 integers

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 Chris Angelico
On Sat, Dec 22, 2012 at 7:54 PM, Pierre Quentel pierre.quen...@gmail.com 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

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 Python,

Re: Brython - Python in the browser

2012-12-22 Thread Chris Angelico
On Sat, Dec 22, 2012 at 10:05 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info 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

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 meaning that makes reasonable

Re: Brython - Python in the browser

2012-12-22 Thread Ian Kelly
On Sat, Dec 22, 2012 at 1:31 PM, Dan Sommers d...@tombstonezero.net 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

Re: Brython - Python in the browser

2012-12-22 Thread Chris Angelico
On Sun, Dec 23, 2012 at 7:31 AM, Dan Sommers d...@tombstonezero.net 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 which is

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-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

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 I urge you to

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 Chris Angelico
On Fri, Dec 21, 2012 at 11:38 PM, Pierre Quentel pierre.quen...@gmail.com 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

Re: Brython - Python in the browser

2012-12-21 Thread Duncan Booth
Pierre Quentel pierre.quen...@gmail.com 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

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 ElementTree or

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 Chris Angelico
On Sat, Dec 22, 2012 at 2:36 AM, Pierre Quentel pierre.quen...@gmail.com 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

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 3

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 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 Ian Kelly
On Fri, Dec 21, 2012 at 9:16 AM, Pierre Quentel pierre.quen...@gmail.com 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

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 probably

Re: Brython - Python in the browser

2012-12-21 Thread Ian Kelly
On Fri, Dec 21, 2012 at 1:59 PM, Pierre Quentel pierre.quen...@gmail.com 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

Re: Brython - Python in the browser

2012-12-21 Thread Chris Angelico
On Sat, Dec 22, 2012 at 3:36 AM, Pierre Quentel pierre.quen...@gmail.com 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

Re: Brython - Python in the browser

2012-12-21 Thread Ian Kelly
On Fri, Dec 21, 2012 at 3:52 PM, Chris Angelico ros...@gmail.com wrote: On Sat, Dec 22, 2012 at 3:36 AM, Pierre Quentel pierre.quen...@gmail.com 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

Re: Brython - Python in the browser

2012-12-21 Thread Amirouche Boubekki
Héllo, doc = 'blah blah xy: '+B('True!') 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

Re: Brython - Python in the browser

2012-12-21 Thread Ian Kelly
On Fri, Dec 21, 2012 at 4:45 PM, Ian Kelly ian.g.ke...@gmail.com 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 Ian Kelly
On Fri, Dec 21, 2012 at 4:45 PM, Ian Kelly ian.g.ke...@gmail.com 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

Re: Brython - Python in the browser

2012-12-21 Thread Chris Angelico
On Sat, Dec 22, 2012 at 10:57 AM, Ian Kelly ian.g.ke...@gmail.com 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

Re: Brython - Python in the browser

2012-12-21 Thread Chris Angelico
On Sat, Dec 22, 2012 at 10:50 AM, Amirouche Boubekki amirouche.boube...@gmail.com 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

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-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, tablets,

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 tjre...@udel.edu 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

Re: Brython - Python in the browser

2012-12-20 Thread Chris Angelico
On Thu, Dec 20, 2012 at 8:37 PM, Pierre Quentel pierre.quen...@gmail.com 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

Re: Brython - Python in the browser

2012-12-20 Thread Jamie Paul Griffin
* Ian Kelly ian.g.ke...@gmail.com [2012-12-19 17:54:44 -0700]: On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy tjre...@udel.edu 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

Re: Brython - Python in the browser

2012-12-20 Thread Terry Reedy
On Thu, Dec 20, 2012 at 8:37 PM, Pierre Quentel pierre.quen...@gmail.com 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

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 pierre.quen...@gmail.com 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

Re: Brython - Python in the browser

2012-12-20 Thread Chris Angelico
On Fri, Dec 21, 2012 at 1:05 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info 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

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

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 --

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

Re: Brython - Python in the browser

2012-12-19 Thread Ian Kelly
On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy tjre...@udel.edu 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.

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 tjre...@udel.edu 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