News for hackers. Stuff that matters.
Re:Python Facts by veyron on Friday November 25, 2011 @10:33AM (#3277272)
Is this approach (sending the commands to a backend) preferable to a javascript-based repl (using something like emscripten)?
Re:Python Facts by ronreiter on Friday November 25, 2011 @10:47AM (#3277318)
yes, but it's jailed pretty good and it's not a lot of CPU power to execute, so it's OK.
Re:Python Facts by nanotone on Friday November 25, 2011 @11:37AM (#3277459)
It looks like you're using GAE. Not having much experience with it, I'm wondering if GAE provides the CPU jailing, or did you have to write some voodoo yourself?

I ask because it's trivially easy to send a statement containing a single bytecode that takes a really long time to execute, at least in CPython:

>>> print 999 * 0 # => 0, so not a bandwidth issue

If I send this to your backend in a bunch of tabs (I didn't) could that be a DoS?

Also, are you thinking of putting the backend code on github?

EDIT: HN swallowed my exponentiation. That should read "print nine to the nine to the nine, times zero". Without the times zero, that's a huge number.

Re:Python Facts by d0mine on Friday November 25, 2011 @11:15PM (#3279041)

  >>> print 9**9**9*0 # => 0
Text after a blank line that is indented by two or more spaces is reproduced verbatim. http://news.ycombinator.com/formatdoc (the help link is in the bottom-right corner)
Re:Python Facts by RyanMcGreal on Friday November 25, 2011 @11:30AM (#3277440)
It allows `eval()` to run. Please see this:

http://diveintopython3.ep.io/advanced-iterators.html#eval

Re:Python Facts by MostAwesomeDude on Friday November 25, 2011 @10:50AM (#3277326)
"There should be one -- and preferably only one -- obvious way to do it. If the implementation is easy to explain, it may be a good idea." AFAIK there is not a JavaScript version of Python which is fully compliant with the Python 2.6 specification.
Re:Python Facts by ronreiter on Friday November 25, 2011 @10:53AM (#3277335)
I think he meant that it would be better if the Python interpreter would be implemented in Javascript. right?
Re:Python Facts by MostAwesomeDude on Friday November 25, 2011 @05:57PM (#3278479)
Yes, and I meant that it would not be better to do this in JavaScript: It's far eaiser and simpler to have a real Python interpreter be doing the heavy lifting.