edit: except FUD, can you provide some points on which brython is failling, please ?
x = 0
def impure():
global x
x += 1
return x
print(0 < impure() <= 1)
In python, impure() would only be evaluated once returning True, but Brython's chaining evaluates it twice, and so it returns False instead. Of course, this example isn't exactly something you'd usually see in actual code (heck, it's probably even bad practice in most situations) BUT the point here is that while most of python might be compatible with this, there exists some inconsistencies that causes one's previously working python code to fail (and these bugs would probably be very difficult to trace). Of course, Brython is still young and has time to hopefully fix these issues. (In fact, this is the second time I've tried this project. Back then they didn't even have the chaining feature working, so it's nice that they are making progress.)PyPy, jython, ironpython etc all had/have incompatibilities as the language evolves and as they work out the quirks in their respective runtimes.
This isn't compatible with cpython (afaik, none of the other runtimes have ever been COMPLETELY compatible, but this is much further off), but hell, it's pretty awesome.
As an aside, I'd shoot anyone who did that ^^ without a pretty amazing explaination.
It is a cool project, whichever one of these python in javasript things is to become successful needs to aim for the same level of compatibility as say Jython or IronPython - yes it would take a long time, but this sort of thing is needed to be a useful implementation.
x = 1
def test():
print(x)
x = 2 def f():
n = 0
while n < 10:
yield n
n += 1
print(n)
g = f()
print(next(g))
This prints 0, 1, ... 10, 0 instead of just 0