So now for your homework, go and extend my spyder with the following commands--
we have s step one line--this is already in there, we have c for continue execution,
and we have quit--this is already in there.
Now come the extra command--we have p for print all variables and also with an extra argument,
which should print the variable as variable equals value.
We want to have commands to set breakpoints--b at line sets a breakpoint in line,
meaning that after you enter this command, execution will always stop
whenever that line is reached, and finally, special command and is specially useful--
if you typed in w for watch point or anything that starts with w such as watch
and give a variable name as argument, then the program should stop
whenever the variable changes its value.
With these commands, you can actually go and debug the remove HTML markup function
step by step, printing out individual variables, but as we discussed today,
you should go and use the scientific method for your homework.
We will test your debugger by coming up with commands such as these
and of course, expecting very specific output.
This is an extra part that will not be graded, which you can do just for fun.
Dunque, ora come compiti per casa, estendi my-spyder con i comandi che seguono:
abbiamo s step di 1 riga -- questo c'e' gia', abbiamo c per continua l'esecuzione,
e abbiamo quit -- questi ci sono gia'.
E adesso ecco i comandi extra: c'e' p per visualizzare tutte le variabili e con degli argomenti aggiuntivi
che dovrebbe stampare a video variabile = valore.
Vorremmo avere un comando per mettere breakpoints: b a riga, mette un breakpoint alla riga,
cioe' dopo che inserisci questo comando l'esecuzione si stoppa sempre
quando arriva a quella riga e, infine, un comando speciale che e' particolarmente utile,
se inserisci w per watch point (punto di osservazione) o qualsiasi cosa inizi con w
e dai un nome di variabile come argomento, il programma dovrebbe fermarsi
ogni volta che la variabile cambia di valore.
Con questi comandi, potrai effettivamente fare il debug della funzione remove-html-debug
passo-passo, visualizzando le singole variabili, ma, come abbiamo gia' discusso oggi,
dovresti usare il metodo scientifico. Per i compiti per casa,
proveremo il tuo debugger usando comandi come questi
e, naturalmente, ci aspettiamo un certo output.
Questa e' una parte extra e non verra' giudicata, la potrai fare per puro divertimento.
では宿題です
my-spyderを次のコマンドを用いて拡張してください
sは1ラインずつ進むという意味で
cは実行を継続するという意味です
qは終了でこの3つはすでに定義済みです
ここでさらにコマンドを追加しましょう
pはすべての変数を出力するという意味にします
pに引数varを指定することで
その変数の値が出力されるようにしましょう
ブレイクポイントを設定するコマンドb lineも作ります
lineはブレイクポイントを設定する行です
つまりこのコマンドを入力すると
lineで指定した行で実行が中断します
そして最後に特別に役立つコマンドを設定しましょう
wは監視ポイントを設定するコマンドにします
引数varに変数の名前を入れると
変数の値が変わった時に
プログラムを中断するようにします
これらのコマンドを使って実際に
remove_html_markup関数をデバッグし
各変数の値を出力します
そして今までご説明したとおり
科学的手法を使ってみてください
このようなコマンドを使い出力の内容を予測することで
自分のデバッガをテストするのです
これは特別な部分なので評価は行いませんが
楽しみとして取り組んでください
到你做作业了,根据下面命令,扩展myspyder--
s表示执行一行--已经有了,c表示继续执行,
还有quit,也已经存在了。
新命令p-输出所有变量值,它带个额外的参数的话,
打印就应该成这样:var = value。
还有设置断点的命令--b 行数,在该行设置断点,
也就是说输入这个命令后,程序总会停下来,
只要它执行到了这一行。特殊的命令有独特的用处--
如果你输入w(视点或别的),格式w var
给定变量名作参数,则程序应该暂停在
变量改变了它的值的时候。
有了这些命令,你就可以去调试那个删除HTML标签的函数了,
一步一步地调试,打印变量,但正如我们今天据说的,
你应该用科学方法来解决你的作业。
我们会测试你的调试器,通过运行若干次这些命令,
当然,还有预期的输出。
这部分将不计入分数,just for fun。