This isn't really true. This is far from a Python implementation. At best you could call it a Python-esque syntax to Javascript translator. And that's perhaps still useful. But to call this a Python implementation is quite simply a lie.
edit: except FUD, can you provide some points on which brython is failling, please ?
> Brython is designed to replace Javascript as the scripting language for the Web
I'm not sure if the developer is one person or if they wrote the landing page as well, but let's assume it is that same person.
If someone has focused enough energy to implement a language in JavaScript, it is probably fair say that marketing isn't his or her primary skill.
At the same time, reading over the text again, people have said crazier things and done much less. If the developer's goal is to replace JavaScript with Python and his or her first attempt is to implement Python in JavaScript, I, for one, applaud their effort.
and walked: "through the valley"' he's and feared: not: "evil"!
# he.and_walked("through the valley").and_feared(not("evil"))!
drop down:' criminal scum!
# criminal_scum.drop_down()!
eat: breakfast' you!
# you.eat(breakfast)!
kill: with pistol' maim: blunt object' opponent's check dead:
# opponent.maim(blunt_object).kill(with_pistol).check_dead()
print person's name's last
print person's last' name # ;)
# print person.name.last
if my's cookies's jar's empty::
print "Cookie Monster, why is the Cookie jar empty?"
why: cookie jar's empty:' cookie monster
# why cookie monster, why? :)
why: cookie jar's empty:' cookie monster's why: "?"
it's called Glas :)It would be amazing if browsers added interpreters natively, then we could check for a native interpreter and fall back to loading a JS one like brython.
https://github.com/jashkenas/coffee-script/wiki/List-of-lang...
Repo: https://github.com/replit/empythoned
Live demo: http://repl.it/languages/Python
CoffeeScript page: "CoffeeScript is a little language that compiles into JavaScript."
Brython page: "Brython is designed to replace Javascript as the scripting language for the Web."
Maybe that's the end goal, but the reality is far from it. Of course JS is still required, and of course the Python gets compiled into JS.
Finally, the approach seems a bit off. I would think it would be better for the Python to be compiled with a pre-processor, not done on the client.
The goal of Brython is to replace javascript on the web, seems straightforward right? The way they go about it is to implement a compiler in javascript, and use that to bootstrap a python in the browser community. Seems like that is much easier than convincing Chrome/Firefox/IE to include a python compiler in their browser.
How would Brython replace javascript if it were precompiled on the server?
One isn't necessarily better than the other - sometimes human generated python source code in the browser may be more useful than machine generated javascript.
If nothing else, it allows us to explore a new way of constructing web apps and determine whether it is better.
I guess it can be solved by gziping the file, or base64 encoding it. But this is also an argument (albeit trivial or weak) for compiling it on the server rather than the client.
Have any of these been used in production with any success. It seems like PyJS had most traction?
It looks as though, some developers are almost insulted by the idea, that someone tried to replace a language that is so commonly accepted, and that they have worked so hard to master.
This also happens in many other fields of science/technology, but I'm always surprised to see it among programmers who are considered very practical people.
I don't think it is universally true. Myself I know how much I can be taken away by a new technology or knowledge.
Ever met an Enterprise Architect?
I got something of value by tweeking NoScript - knowledge, not just ads. Then again, I'm a yokel.
This should really be fixed.
Also "from html import *"? No no no. Never, not even once.
Also it's defined at the bottom of the script which, I admit, is a bit weird:
if hasattr(canvas,'getContext'):
ctx = canvas.getContext("2d")
from html import * looks bad, I agree, but I believe they did that to allow us to play with their toy from the console.Perhaps a development plugin for Chrome would allow debugging in python?
However, because of performance reasons, the very features that make python unique, especially the type system, are more javascript-like than python-like.
What I would like to see is a Python-implementation which is mostly feature complete, along the lines of emscripten, but still has direct access to the dom or other javascript objects.
It's way nicer in my opinion, but I think its fussy white space is likely to be an issue for this use case. All the large Javascript libraries get minified etc, and Python really isn't open to that sort of stuff. It's a great language to use normally, but I don't see it replacing Javascript. I'd much rather write in Python and compile to Javascript though.
edit: looks like if you remove "_en" then you get to the right place, http://www.brython.info/tests/console.html
Looks like pyjs, in that it has python syntax but JavaScript semantics, for example numbers turn into doubles here (but should be arbitrary-precision ints in Python).
>>> a = 1/3
>>> type(a)
int
python 3.2 >>> a = 1/3
>>> type(a)
<class 'float'>
brython: print(type(1/3))
<class 'float'> x = 1
for i in range(100):
x = x*2
print(i, x)Not CoffeeScript - I want to be able to write Ruby that manipulates DOM objects.
Javascript is great, but I'd rather work in Python and have it be actual Python, not an interpreter written in an interpreted language.
How is V8 wired into Chrome, or Rhino(?) into Firefox, for example? Is there a great technical barrier to making it possible for the user to install an interpreter of their choice? As I understand the course of the browser's history, it already seems to be moving to an OS-style program (or, in Chrome's case, it has BECOME an OS), so it seems like user-loaded language runtimes OUGHT to be on SOMEONE'S mind. And I'd be surprised if it hasn't already occurred to someone before, I just don't know the history.
Has anyone attempted to write a browser that allowed for such a thing? Or has JS just been the accepted scripting language, and no one has yet tried to push past?
There seems to be this gah a fucking ruby developer/thing, again motif going on around HN (was hurtful at first) that makes it harder to discover cool and new ruby things!
P.S: although Python is nit my goto language, I still find this brilliant!
JS has been in use around the web for a long time now and I don't see the need why should I go about using Python for the very same? Doesn't one language has a purpose of it's own?
If it wasn't the case, then people would have worked on creating a unified language for all our needs.
Doesn't one language has a purpose of it's own?
Usually no, most domains are served by more than one language, otherwise we would all be using Perl to write server-side web applications.
While it's debatable whether JavaScript is particularly well suited for client-side web code, the fact is that having only one language of choice is mostly an historical accident.
Python is great for some stuff, but let JS do what it does.
I wish I could have a choice of the language to run in the browser, and still do all the things javascript can. Having some kind of a bytecode virtual machine on the browser, that many different languages can compile to, might be the best solution.
an interesting rant from Zed Shaw on this http://vimeo.com/43380467
Again, not that I don't agree, it's just hard to stay up to date with the greatest while still trying to support outdated tech like html tables.
The W3C is the 'authority', but is really at the hands of the major browser manufacturers. Implementing an interpreted version of Python sounds great, but is it worth the time and effort? Will it increase my productivity or compliance compared to JavaScript? As of now, nope.
I'm happy writing bastardized JS (not that my code is bastardized, rather that's just the language [took way too long to understand == vs ===]) for the web right now. Every day new tools and frameworks are developed to make it easier, and I just don't see the advantage and overhead just to write a weird version of python that compiles into JS.
Issues with the examples:
I got nobody walking on the 3d walker (Chrome on Ubuntu); also it was psychedelic fun clicking into negative territory on the pie chart.
there are open source projects that decompile them to runnable code, the original symbol names are even intact - this means you don't lose the original naming of variables, functions, arguments, etc.
No, browsers cannot magically run python now.