How does Udacity web Python interpreter work?

前端 未结 3 1982
长发绾君心
长发绾君心 2021-02-20 08:50

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 tech

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-20 09:52

    Very late to the party here, but I work as an engineer at Udacity, so I figured I'd give it a shot.

    There are two fundamental things going on:

    1. The current syntax highlighting and editing is provided by a Codemirror implementation, although we have used several different editors in the past couple years.
    2. When you hit submit (or run), your code is packaged up and shipped off to a sandboxed cluster we run for execution. If you're hitting submit, this is where we run our own tests against your code and "grade" it to see if it passes. The output from that (in various forms) is piped back to the front end, and you get your feedback.

    Not quite as fast as running it locally, but it sure beats supporting a few hundred thousand people trying to install Python for the first time ;)

提交回复
热议问题