pythontutor้กน็ฎ่งฃๅ
่ฏดๆ
ๆฌๆไธป่ฆๅๆไธไธpythontutor็้กน็ฎ็ปๆไธไธๅกๆต็จ๏ผๅนถ็กฎๅฎๅ้ข็็ธๅ ณไปฃ็ ๅฏ่งๅ็ไฝฟ็จๆนๆณ
ๆปไฝ็ปๆๅพ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ _ _ โ
โ _ __ __ _ __| |____ _ __ _ ___ (_)___ ___ _ _ โ
โ | '_ \/ _` / _| / / _` / _` / -_)_ | (_-</ _ \ ' \ โ
โ | .__/\__,_\__|_\_\__,_\__, \___(_)/ /__/\___/_||_| โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ |_| |___/ |__/ โ
โ ___ _ _ _____ _ ___ โ โ โ
โ | _ \_ _| |_| |_ ___ _ _ |_ _| _| |_ ___ _ _ | __|_ _____ __ โ โ { โ
โ | _/ || | _| ' \/ _ \ ' \ | || || | _/ _ \ '_| | _|\ \ / -_) _| โ โ "name": "v5-unity", โ
โ |_| \_, |\__|_||_\___/_||_| |_| \_,_|\__\___/_| |___/_\_\___\__| โ โ "version": "1.0.0", โ
โ |__/ โ โ "description": "OPT v5", โ
โ โ โ "main": "bundle.js", โ
โ โ โ "repository": "https://github.com/pgbovine/OnlinePythonTutor", โ
โ โ โ "license": "BSD-3-Clause", โ
โ โ โ "scripts": { โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ "start": "python bottle_server.py", โ
โ โ โ โ โ "py3start": "python3 bottle_server.py", โ
โ โ botter_server.py โ โ โโโโโโโโโโโซ "webpack": "webpack --devtool sourcemap --progress --colors --watch", โ
โ โ get_py_exec โโโโโโโโโโโโโโ โ โ โ "production-build": "rm -f build/* && webpack && python โ
โ โ โ โ โ โ โ add_cache_busting_query_strings.py" โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ }, โ
โ โ โ โ โ "dependencies": { โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ "css-loader": "", โ
โ โโโโโโโโโโโโโถ โ โ npm run production-build โ "fs-extra": "^6.0.1", โ
โ โ pg_logger.py โ โ โ โ "json-stable-stringify": "^1.0.1", โ
โ โ exec_script_str_local โ โ โ โ "on-build-webpack": "^0.1.0", โ
โ โโโโโโโโโโโโโค โ โ โ โ "pixelmatch": "^4.0.2", โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ "puppeteer": "^1.5.0", โ
โ โ โ โ โ โ โ "script-loader": "", โ
โ โ โ โ /visualize.html โ โ โ "style-loader": "", โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโถ visualize.bundle.js โโโโโโโโโโ โ "ts-loader": "^3.5.0", โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โ โ "url-loader": "" โ
โ โ โโโโโโโโโโโโโ return trace info โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ } โ
โ โ pg_logger.py โ {code: '', trace: []} โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฒโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ PGLogger._runscript โ โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ webpack
โ โ โ
โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโปโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ โ _ _ __ _ _ โ
โ โ โ __ __ _____| |__ _ __ __ _ __| |__ __ ___ _ _ / _(_)__ _ (_)___ โ
โ โ โ \ V V / -_) '_ \ '_ \/ _` / _| / /_/ _/ _ \ ' \| _| / _` |_ | (_-< โ
โ โ โ \_/\_/\___|_.__/ .__/\__,_\__|_\_(_)__\___/_||_|_| |_\__, (_)/ /__/ โ
โ โ โ |_| |___/ |__/ โ
โ โ โ entry: { โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ 'visualize': "./js/visualize.ts", โ
โ 'recorder': "./js/recorder.ts", โ
โ 'render-trace': "./js/render-trace.ts", โ
โ 'opt-live': "./js/opt-live.ts", โ
โ 'iframe-embed': "./js/iframe-embed.ts", โ
โ 'index': "./js/index.ts", โ
โ 'composingprograms': "./js/composingprograms.ts", โ
โ 'csc108h': "./js/csc108h.ts", โ
โ 'pytutor-embed': "./js/pytutor-embed.ts", โ
โ }, โ
โ โ
โ output: { โ
โ path: __dirname + "/build/", โ
โ // TODO: use 'bundle.[hash].js' for fingerprint hashing โ
โ // to create unique filenames for releases: โ
โ // https://webpack.github.io/docs/long-term-caching.html โ
โ filename: "[name].bundle.js", โ
โ sourceMapFilename: "[file].map", โ
โ }, โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
iframeไฝฟ็จ็คบไพ
ไฝฟ็จbottleๅwebๆๅก
from bottle import route, get, request, run, template, static_file
try:
import StringIO # NB: don't use cStringIO since it doesn't support unicode!!!
except:
import io as StringIO # py3
import json
import pg_logger
@route('/web_exec_<name:re:.+>.py')
@route('/LIVE_exec_<name:re:.+>.py')
@route('/viz_interaction.py')
@route('/syntax_err_survey.py')
@route('/runtime_err_survey.py')
@route('/eureka_survey.py')
@route('/error_log.py')
def dummy_ok(name=None):
return 'OK'
@route('/<filepath:path>')
def index(filepath):
return static_file(filepath, root='.')
# Note that this will run either Python 2 or 3, depending on which
# version of Python you used to start the server, REGARDLESS of which
# route was taken:
@route('/web_exec_py2.py')
@route('/web_exec_py3.py')
@route('/LIVE_exec_py2.py')
@route('/LIVE_exec_py3.py')
def get_py_exec():
out_s = StringIO.StringIO()
def json_finalizer(input_code, output_trace):
ret = dict(code=input_code, trace=output_trace)
json_output = json.dumps(ret, indent=None)
out_s.write(json_output)
options = json.loads(request.query.options_json)
pg_logger.exec_script_str_local(request.query.user_script,
request.query.raw_input_json,
options['cumulative_mode'],
options['heap_primitives'],
json_finalizer)
return out_s.getvalue()
if __name__ == "__main__":
run(host='localhost', port=8003, reloader=True)
่ฟ้ๅฏไปฅๅ็ฐ๏ผไฝ่ ็่ทฏ็ฑๅบๆฌๆฑ่ๅจget_py_exec, ่ฟๅ ฅๅๆง่กexec_script_str_local
pg_logger.pyไป็ป
โโโโโโโโโโโโโโโโโโโโโ
โ โ
โ botter_server.py โ
โ get_py_exec โโโโโโโโโโโโโโโโ
โ โ โ
โโโโโโโโโโโโโโโโโโโโโ โ
โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโถ โ
โ pg_logger.py โ
โ exec_script_str_local โ
โโโโโโโโโโโโโค โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโ
โ pg_logger.py โ
โ PGLogger._runscript โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
็ปงๆฟ่ชBdb
class PGLogger(bdb.Bdb):
ๅๅงๅ็ธๅ ณ
def __init__(
self,
cumulative_mode,
heap_primitives,
show_only_outputs,
finalizer_func,
disable_security_checks=False,
allow_all_modules=False,
crazy_mode=False,
custom_modules=None,
separate_stdout_by_module=False,
probe_exprs=None):
่ฐ็จๅฝๆฐ
def exec_script_str_local(
script_str,
raw_input_lst_json,
cumulative_mode,
heap_primitives,
finalizer_func,
probe_exprs=None,
allow_all_modules=False):
# ๆ ธๅฟ่ฟ่ก่ฟ็จ่ฎฐๅฝ็ฑป
logger = PGLogger(
cumulative_mode,
heap_primitives,
False,
finalizer_func,
disable_security_checks=True,
allow_all_modules=allow_all_modules,
probe_exprs=probe_exprs
)
# TODO: refactor these NOT to be globals
global input_string_queue
input_string_queue = []
if raw_input_lst_json:
# TODO: if we want to support unicode, remove str() cast
input_string_queue = [str(e) for e in json.loads(raw_input_lst_json)]
try:
logger._runscript(script_str)
except bdb.BdbQuit:
pass
finally:
return logger.finalize()
่ฟๅๆฐๆฎ็คบไพ
{
"code": "# The __init__ 'constructor' - object-oriented programming intro\n# Adapted from MIT 6.01 course notes (Section 3.5)\n# http://mit.edu/6.01/mercurial/spring10/www/handouts/readings.pdf\n\nclass Staff601:\n course = '6.01'\n building = 34\n room = 501\n\n def __init__(self, name, role, years, salary):\n self.name = name\n self.role = role\n self.age = years\n self.salary = salary\n\n def salutation(self):\n return self.role + ' ' + self.name\n\npat = Staff601('Pat', 'Professor', 60, 100000)\nprint(pat.salutation())",
"trace": [
{
"line": 5,
"event": "step_line",
"func_name": "<module>",
"globals": {},
"ordered_globals": [],
"stack_to_render": [],
"heap": {},
"stdout": "# The __init__ 'constructor' - object-oriented programming intro\n# Adapted from MIT 6.01 course notes (Section 3.5)\n# http://mit.edu/6.01/mercurial/spring10/www/handouts/readings.pdf\n\nclass Staff601:\n course = '6.01'\n building = 34\n room = 501\n\n def __init__(self, name, role, years, salary):\n self.name = name\n self.role = role\n self.age = years\n self.salary = salary\n\n def salutation(self):\n return self.role + ' ' + self.name\n\npat = Staff601('Pat', 'Professor', 60, 100000)\nprint(pat.salutation())\n"
},
{
"line": 19,
"event": "step_line",
"func_name": "<module>",
"globals": {
"Staff601": [
"IMPORTED_FAUX_PRIMITIVE",
"imported class"
]
},
"ordered_globals": [
"Staff601"
],
"stack_to_render": [],
"heap": {},
"stdout": "# The __init__ 'constructor' - object-oriented programming intro\n# Adapted from MIT 6.01 course notes (Section 3.5)\n# http://mit.edu/6.01/mercurial/spring10/www/handouts/readings.pdf\n\nclass Staff601:\n course = '6.01'\n building = 34\n room = 501\n\n def __init__(self, name, role, years, salary):\n self.name = name\n self.role = role\n self.age = years\n self.salary = salary\n\n def salutation(self):\n return self.role + ' ' + self.name\n\npat = Staff601('Pat', 'Professor', 60, 100000)\nprint(pat.salutation())\n"
},
{
"line": 10,
"event": "call",
"func_name": "__init__",
"globals": {
"Staff601": [
"IMPORTED_FAUX_PRIMITIVE",
"imported class"
]
},
"ordered_globals": [
"Staff601"
],
"stack_to_render": [
{
"func_name": "__init__",
"is_parent": false,
"frame_id": 1,
"parent_frame_id_list": [],
"encoded_locals": {
"self": [
"REF",
1
],
"name": "Pat",
"role": "Professor",
"years": 60,
"salary": 100000
},
"ordered_varnames": [
"self",
"name",
"role",
"years",
"salary"
],
"is_zombie": false,
"is_highlighted": true,
"unique_hash": "__init___f1"
}
],
"heap": {
"1": [
"INSTANCE",
"Staff601"
]
},
"stdout": "# The __init__ 'constructor' - object-oriented programming intro\n# Adapted from MIT 6.01 course notes (Section 3.5)\n# http://mit.edu/6.01/mercurial/spring10/www/handouts/readings.pdf\n\nclass Staff601:\n course = '6.01'\n building = 34\n room = 501\n\n def __init__(self, name, role, years, salary):\n self.name = name\n self.role = role\n self.age = years\n self.salary = salary\n\n def salutation(self):\n return self.role + ' ' + self.name\n\npat = Staff601('Pat', 'Professor', 60, 100000)\nprint(pat.salutation())\n"
},
{
"line": 11,
"event": "step_line",
"func_name": "__init__",
"globals": {
"Staff601": [
"IMPORTED_FAUX_PRIMITIVE",
"imported class"
]
},
"ordered_globals": [
"Staff601"
],
"stack_to_render": [
{
"func_name": "__init__",
"is_parent": false,
"frame_id": 1,
"parent_frame_id_list": [],
"encoded_locals": {
"self": [
"REF",
1
],
"name": "Pat",
"role": "Professor",
"years": 60,
"salary": 100000
},
"ordered_varnames": [
"self",
"name",
"role",
"years",
"salary"
],
"is_zombie": false,
"is_highlighted": true,
"unique_hash": "__init___f1"
}
],
"heap": {
"1": [
"INSTANCE",
"Staff601"
]
},
"stdout": "# The __init__ 'constructor' - object-oriented programming intro\n# Adapted from MIT 6.01 course notes (Section 3.5)\n# http://mit.edu/6.01/mercurial/spring10/www/handouts/readings.pdf\n\nclass Staff601:\n course = '6.01'\n building = 34\n room = 501\n\n def __init__(self, name, role, years, salary):\n self.name = name\n self.role = role\n self.age = years\n self.salary = salary\n\n def salutation(self):\n return self.role + ' ' + self.name\n\npat = Staff601('Pat', 'Professor', 60, 100000)\nprint(pat.salutation())\n"
},
{
"line": 12,
"event": "step_line",
"func_name": "__init__",
"globals": {
"Staff601": [
"IMPORTED_FAUX_PRIMITIVE",
"imported class"
]
},
"ordered_globals": [
"Staff601"
],
"stack_to_render": [
{
"func_name": "__init__",
"is_parent": false,
"frame_id": 1,
"parent_frame_id_list": [],
"encoded_locals": {
"self": [
"REF",
1
],
"name": "Pat",
"role": "Professor",
"years": 60,
"salary": 100000
},
"ordered_varnames": [
"self",
"name",
"role",
"years",
"salary"
],
"is_zombie": false,
"is_highlighted": true,
"unique_hash": "__init___f1"
}
],
"heap": {
"1": [
"INSTANCE",
"Staff601",
[
"name",
"Pat"
]
]
},
"stdout": "# The __init__ 'constructor' - object-oriented programming intro\n# Adapted from MIT 6.01 course notes (Section 3.5)\n# http://mit.edu/6.01/mercurial/spring10/www/handouts/readings.pdf\n\nclass Staff601:\n course = '6.01'\n building = 34\n room = 501\n\n def __init__(self, name, role, years, salary):\n self.name = name\n self.role = role\n self.age = years\n self.salary = salary\n\n def salutation(self):\n return self.role + ' ' + self.name\n\npat = Staff601('Pat', 'Professor', 60, 100000)\nprint(pat.salutation())\n"
},
{
"line": 13,
"event": "step_line",
"func_name": "__init__",
"globals": {
"Staff601": [
"IMPORTED_FAUX_PRIMITIVE",
"imported class"
]
},
"ordered_globals": [
"Staff601"
],
"stack_to_render": [
{
"func_name": "__init__",
"is_parent": false,
"frame_id": 1,
"parent_frame_id_list": [],
"encoded_locals": {
"self": [
"REF",
1
],
"name": "Pat",
"role": "Professor",
"years": 60,
"salary": 100000
},
"ordered_varnames": [
"self",
"name",
"role",
"years",
"salary"
],
"is_zombie": false,
"is_highlighted": true,
"unique_hash": "__init___f1"
}
],
"heap": {
"1": [
"INSTANCE",
"Staff601",
[
"name",
"Pat"
],
[
"role",
"Professor"
]
]
},
"stdout": "# The __init__ 'constructor' - object-oriented programming intro\n# Adapted from MIT 6.01 course notes (Section 3.5)\n# http://mit.edu/6.01/mercurial/spring10/www/handouts/readings.pdf\n\nclass Staff601:\n course = '6.01'\n building = 34\n room = 501\n\n def __init__(self, name, role, years, salary):\n self.name = name\n self.role = role\n self.age = years\n self.salary = salary\n\n def salutation(self):\n return self.role + ' ' + self.name\n\npat = Staff601('Pat', 'Professor', 60, 100000)\nprint(pat.salutation())\n"
},
{
"line": 14,
"event": "step_line",
"func_name": "__init__",
"globals": {
"Staff601": [
"IMPORTED_FAUX_PRIMITIVE",
"imported class"
]
},
"ordered_globals": [
"Staff601"
],
"stack_to_render": [
{
"func_name": "__init__",
"is_parent": false,
"frame_id": 1,
"parent_frame_id_list": [],
"encoded_locals": {
"self": [
"REF",
1
],
"name": "Pat",
"role": "Professor",
"years": 60,
"salary": 100000
},
"ordered_varnames": [
"self",
"name",
"role",
"years",
"salary"
],
"is_zombie": false,
"is_highlighted": true,
"unique_hash": "__init___f1"
}
],
"heap": {
"1": [
"INSTANCE",
"Staff601",
[
"age",
60
],
[
"name",
"Pat"
],
[
"role",
"Professor"
]
]
},
"stdout": "# The __init__ 'constructor' - object-oriented programming intro\n# Adapted from MIT 6.01 course notes (Section 3.5)\n# http://mit.edu/6.01/mercurial/spring10/www/handouts/readings.pdf\n\nclass Staff601:\n course = '6.01'\n building = 34\n room = 501\n\n def __init__(self, name, role, years, salary):\n self.name = name\n self.role = role\n self.age = years\n self.salary = salary\n\n def salutation(self):\n return self.role + ' ' + self.name\n\npat = Staff601('Pat', 'Professor', 60, 100000)\nprint(pat.salutation())\n"
},
{
"line": 14,
"event": "return",
"func_name": "__init__",
"globals": {
"Staff601": [
"IMPORTED_FAUX_PRIMITIVE",
"imported class"
]
},
"ordered_globals": [
"Staff601"
],
"stack_to_render": [
{
"func_name": "__init__",
"is_parent": false,
"frame_id": 1,
"parent_frame_id_list": [],
"encoded_locals": {
"self": [
"REF",
1
],
"name": "Pat",
"role": "Professor",
"years": 60,
"salary": 100000,
"__return__": null
},
"ordered_varnames": [
"self",
"name",
"role",
"years",
"salary",
"__return__"
],
"is_zombie": false,
"is_highlighted": true,
"unique_hash": "__init___f1"
}
],
"heap": {
"1": [
"INSTANCE",
"Staff601",
[
"age",
60
],
[
"name",
"Pat"
],
[
"role",
"Professor"
],
[
"salary",
100000
]
]
},
"stdout": "# The __init__ 'constructor' - object-oriented programming intro\n# Adapted from MIT 6.01 course notes (Section 3.5)\n# http://mit.edu/6.01/mercurial/spring10/www/handouts/readings.pdf\n\nclass Staff601:\n course = '6.01'\n building = 34\n room = 501\n\n def __init__(self, name, role, years, salary):\n self.name = name\n self.role = role\n self.age = years\n self.salary = salary\n\n def salutation(self):\n return self.role + ' ' + self.name\n\npat = Staff601('Pat', 'Professor', 60, 100000)\nprint(pat.salutation())\n"
},
{
"line": 20,
"event": "step_line",
"func_name": "<module>",
"globals": {
"Staff601": [
"IMPORTED_FAUX_PRIMITIVE",
"imported class"
],
"pat": [
"REF",
1
]
},
"ordered_globals": [
"Staff601",
"pat"
],
"stack_to_render": [],
"heap": {
"1": [
"INSTANCE",
"Staff601",
[
"age",
60
],
[
"name",
"Pat"
],
[
"role",
"Professor"
],
[
"salary",
100000
]
]
},
"stdout": "# The __init__ 'constructor' - object-oriented programming intro\n# Adapted from MIT 6.01 course notes (Section 3.5)\n# http://mit.edu/6.01/mercurial/spring10/www/handouts/readings.pdf\n\nclass Staff601:\n course = '6.01'\n building = 34\n room = 501\n\n def __init__(self, name, role, years, salary):\n self.name = name\n self.role = role\n self.age = years\n self.salary = salary\n\n def salutation(self):\n return self.role + ' ' + self.name\n\npat = Staff601('Pat', 'Professor', 60, 100000)\nprint(pat.salutation())\n"
},
{
"line": 16,
"event": "call",
"func_name": "salutation",
"globals": {
"Staff601": [
"IMPORTED_FAUX_PRIMITIVE",
"imported class"
],
"pat": [
"REF",
1
]
},
"ordered_globals": [
"Staff601",
"pat"
],
"stack_to_render": [
{
"func_name": "salutation",
"is_parent": false,
"frame_id": 2,
"parent_frame_id_list": [],
"encoded_locals": {
"self": [
"REF",
1
]
},
"ordered_varnames": [
"self"
],
"is_zombie": false,
"is_highlighted": true,
"unique_hash": "salutation_f2"
}
],
"heap": {
"1": [
"INSTANCE",
"Staff601",
[
"age",
60
],
[
"name",
"Pat"
],
[
"role",
"Professor"
],
[
"salary",
100000
]
]
},
"stdout": "# The __init__ 'constructor' - object-oriented programming intro\n# Adapted from MIT 6.01 course notes (Section 3.5)\n# http://mit.edu/6.01/mercurial/spring10/www/handouts/readings.pdf\n\nclass Staff601:\n course = '6.01'\n building = 34\n room = 501\n\n def __init__(self, name, role, years, salary):\n self.name = name\n self.role = role\n self.age = years\n self.salary = salary\n\n def salutation(self):\n return self.role + ' ' + self.name\n\npat = Staff601('Pat', 'Professor', 60, 100000)\nprint(pat.salutation())\n"
},
{
"line": 17,
"event": "step_line",
"func_name": "salutation",
"globals": {
"Staff601": [
"IMPORTED_FAUX_PRIMITIVE",
"imported class"
],
"pat": [
"REF",
1
]
},
"ordered_globals": [
"Staff601",
"pat"
],
"stack_to_render": [
{
"func_name": "salutation",
"is_parent": false,
"frame_id": 2,
"parent_frame_id_list": [],
"encoded_locals": {
"self": [
"REF",
1
]
},
"ordered_varnames": [
"self"
],
"is_zombie": false,
"is_highlighted": true,
"unique_hash": "salutation_f2"
}
],
"heap": {
"1": [
"INSTANCE",
"Staff601",
[
"age",
60
],
[
"name",
"Pat"
],
[
"role",
"Professor"
],
[
"salary",
100000
]
]
},
"stdout": "# The __init__ 'constructor' - object-oriented programming intro\n# Adapted from MIT 6.01 course notes (Section 3.5)\n# http://mit.edu/6.01/mercurial/spring10/www/handouts/readings.pdf\n\nclass Staff601:\n course = '6.01'\n building = 34\n room = 501\n\n def __init__(self, name, role, years, salary):\n self.name = name\n self.role = role\n self.age = years\n self.salary = salary\n\n def salutation(self):\n return self.role + ' ' + self.name\n\npat = Staff601('Pat', 'Professor', 60, 100000)\nprint(pat.salutation())\n"
},
{
"line": 17,
"event": "return",
"func_name": "salutation",
"globals": {
"Staff601": [
"IMPORTED_FAUX_PRIMITIVE",
"imported class"
],
"pat": [
"REF",
1
]
},
"ordered_globals": [
"Staff601",
"pat"
],
"stack_to_render": [
{
"func_name": "salutation",
"is_parent": false,
"frame_id": 2,
"parent_frame_id_list": [],
"encoded_locals": {
"self": [
"REF",
1
],
"__return__": "Professor Pat"
},
"ordered_varnames": [
"self",
"__return__"
],
"is_zombie": false,
"is_highlighted": true,
"unique_hash": "salutation_f2"
}
],
"heap": {
"1": [
"INSTANCE",
"Staff601",
[
"age",
60
],
[
"name",
"Pat"
],
[
"role",
"Professor"
],
[
"salary",
100000
]
]
},
"stdout": "# The __init__ 'constructor' - object-oriented programming intro\n# Adapted from MIT 6.01 course notes (Section 3.5)\n# http://mit.edu/6.01/mercurial/spring10/www/handouts/readings.pdf\n\nclass Staff601:\n course = '6.01'\n building = 34\n room = 501\n\n def __init__(self, name, role, years, salary):\n self.name = name\n self.role = role\n self.age = years\n self.salary = salary\n\n def salutation(self):\n return self.role + ' ' + self.name\n\npat = Staff601('Pat', 'Professor', 60, 100000)\nprint(pat.salutation())\n"
},
{
"line": 20,
"event": "return",
"func_name": "<module>",
"globals": {
"Staff601": [
"IMPORTED_FAUX_PRIMITIVE",
"imported class"
],
"pat": [
"REF",
1
]
},
"ordered_globals": [
"Staff601",
"pat"
],
"stack_to_render": [],
"heap": {
"1": [
"INSTANCE",
"Staff601",
[
"age",
60
],
[
"name",
"Pat"
],
[
"role",
"Professor"
],
[
"salary",
100000
]
]
},
"stdout": "# The __init__ 'constructor' - object-oriented programming intro\n# Adapted from MIT 6.01 course notes (Section 3.5)\n# http://mit.edu/6.01/mercurial/spring10/www/handouts/readings.pdf\n\nclass Staff601:\n course = '6.01'\n building = 34\n room = 501\n\n def __init__(self, name, role, years, salary):\n self.name = name\n self.role = role\n self.age = years\n self.salary = salary\n\n def salutation(self):\n return self.role + ' ' + self.name\n\npat = Staff601('Pat', 'Professor', 60, 100000)\nprint(pat.salutation())\nProfessor Pat\n"
}
]
}
ๅ่่ตๆ
- KuanHsiaoKuo/OnlinePythonTutor
- KuanHsiaoKuo/PythonTutorService: ๅบไบOnlinePythonTutorๅผๆบ้กน็ฎ่ฟ่กๆนๅ
- bdbไธpdbไป็ป
- Online Python Tutor- Embeddable Web-Based Program Visualization for CS Education.pdf
- Online python tutor: embeddable web-based program visualization for cs education
- Python Tutor code visualizer: Visualize code in Python, JavaScript, C, C++, and Java
- pathrise-python-tutor/embedding-HOWTO.md at master ยท pathrise-eng/pathrise-python-tutor