Udacity Web Python解释器如何工作? [英] How does Udacity web Python interpreter work?

查看:209
本文介绍了Udacity Web Python解释器如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Udacity 为学生提供了一个Web编辑器来输入Python程序。编辑器识别Python关键字和内置函数,并允许运行程序。你知道这项技术是如何运作的吗?程序是提交给后端并由标准Python解释器执行还是基于JavaScript的Python解释器?编辑器是否只是持有Python关键字和内置函数的静态列表,还是与标准或基于JavaScript的Python交互以获取这些?

Udacity gives students a web editor to enter Python programs. The editor recognizes Python keywords and built-in functions and allows to run a program. Do you know how this technology works? Are programs submitted to a backend and executed by the standard Python interpreter or is it a JavaScript based Python interpreter? Does the editor simply hold a static list of Python keywords and built-in functions or does it interact with the standard or JavaScript based Python to obtain these?

推荐答案

虽然存在javascript python解释器: http://syntensity.com/static/python.html ,他们似乎没有使用一个。如果他们至少没有运行一次程序来验证他们自己的翻译,那就太容易作弊了。

While javascript python interpreters do exist: http://syntensity.com/static/python.html , they don't appear to be using one. It would be far too easy to cheat if they didn't at least run the programs once for verification on their own interpreter.

在观察Udacity I上的网络活动之后可以看到他们用一堆数据进行ajax调用,然后用JSON运行程序的结果。

After looking at the network activity on Udacity I can see that they make an ajax call with a bunch of data and then get the results of the program run back in JSON.

猜猜他们有标准的python解释器在将执行分配的沙箱中运行,然后将结果打包到JSON中,返回到客户端并更新到屏幕。同时,您提交的结果将被记录为课程结果的一部分。

At a guess they have the standard python interpreter running in a sandbox that will execute the assignments, then the results are packed into JSON, returned to the client and updated to the screen. At the same time the results of your submission will be recorded as part of your class results.

这篇关于Udacity Web Python解释器如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆