Brython www.brython.infoSpyros Ioakeimidisspyros.ioakeimidis.infoPyGrunn June 2013Python in the client-sideof programming
What the ****are they thinking?Brython???
But How?
Step 1: Read Code
1parses Python source codebrython():
1ajax call for, e.g.<script type=‘text/python’ src=‘example.py’></script>parses Python source codebrython():
Step 2: Syntax Analysis
2abstract tree is built and transformedpy2js():
2the moment to deal with errorsabstract tree is built and transformedpy2js():
Step 3: Generate Javascript
recursively creates the javascriptcode out of the abstract tree3to_js():
Step 4: Execute Javascript
4eval()
Characteristics
numLOC(brython) ≈≈ numLOC(jQuery)Less Code?
importworks with ajax calls
importworks with ajax callsfrom the same directory of the calling script
importworks with ajax callsfrom the same directory of the calling scriptpackages are not supported, only modules
white spaces andindentation matter! :).min
Compatibility✌write Javascript, jQuery codeusing JSObject()Javascript
Compatibilitybrowsers
ajaxajax is pretty easy to use (as it should be)using ajax()
missing...some (not so commonly used) Python functionswith keyword is not implemented yetno cookie implementation
more...no noticeable difference in efficiencyHTML5 and SVG support :)
more...still too immaturedefault use of ajaxundocumented (still to early though :)
The simplest Task app ever!to be continued...
SO?
It doesn’t always feel likewriting Python code
Nothing yet that can distinguishit from existing solutions
“Introducing a new language to replaceJavascript, is just such an incrediblyhard political problem...Guido Van Rossum@PyCo...
I enjoyed much more writing Pythonthan Javascript :)
Thank you!
Upcoming SlideShare
Loading in...5
×

Brython

920

Published on

Over the past few years, many have thought of the concept of using Python, instead of javascript, for client-side programming. Guido van Rossum, during his keynote talk in PyCon 2012, said that "Introducing a new language to replace javascript, is just such an incredibly hard political problem..". During this talk I briefly introduced Brython. Brython's goal is to replace Javascript with Python as the scripting language for web browsers. But lets think about it for a moment.. Is this really what we want? :)

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
920
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Brython

  1. 1. Brython www.brython.infoSpyros Ioakeimidisspyros.ioakeimidis.infoPyGrunn June 2013Python in the client-sideof programming
  2. 2. What the ****are they thinking?Brython???
  3. 3. But How?
  4. 4. Step 1: Read Code
  5. 5. 1parses Python source codebrython():
  6. 6. 1ajax call for, e.g.<script type=‘text/python’ src=‘example.py’></script>parses Python source codebrython():
  7. 7. Step 2: Syntax Analysis
  8. 8. 2abstract tree is built and transformedpy2js():
  9. 9. 2the moment to deal with errorsabstract tree is built and transformedpy2js():
  10. 10. Step 3: Generate Javascript
  11. 11. recursively creates the javascriptcode out of the abstract tree3to_js():
  12. 12. Step 4: Execute Javascript
  13. 13. 4eval()
  14. 14. Characteristics
  15. 15. numLOC(brython) ≈≈ numLOC(jQuery)Less Code?
  16. 16. importworks with ajax calls
  17. 17. importworks with ajax callsfrom the same directory of the calling script
  18. 18. importworks with ajax callsfrom the same directory of the calling scriptpackages are not supported, only modules
  19. 19. white spaces andindentation matter! :).min
  20. 20. Compatibility✌write Javascript, jQuery codeusing JSObject()Javascript
  21. 21. Compatibilitybrowsers
  22. 22. ajaxajax is pretty easy to use (as it should be)using ajax()
  23. 23. missing...some (not so commonly used) Python functionswith keyword is not implemented yetno cookie implementation
  24. 24. more...no noticeable difference in efficiencyHTML5 and SVG support :)
  25. 25. more...still too immaturedefault use of ajaxundocumented (still to early though :)
  26. 26. The simplest Task app ever!to be continued...
  27. 27. SO?
  28. 28. It doesn’t always feel likewriting Python code
  29. 29. Nothing yet that can distinguishit from existing solutions
  30. 30. “Introducing a new language to replaceJavascript, is just such an incrediblyhard political problem...Guido Van Rossum@PyCon 2012
  31. 31. I enjoyed much more writing Pythonthan Javascript :)
  32. 32. Thank you!

×