2016-12-18から1日間の記事一覧
with 文が使える関数をつくる yield 式のところで with ブロックの内容が実行される #with_openthebook.py from contextlib import contextmanager class Book(): def __init__(self): self.contents = '' self.isopen = False def open(self): self.isopen …
jupyter qtconsole をフォント指定して起動 jupyter qtconsole --ConsoleWidget.font_family="MyricaM M" --ConsoleWidget.font_size=12
対話的デバッガ デバッグしたい部分に次の一文を挿入 import pdb; pdb.set_trace() (Pdb) プロンプトのコマンド(の例) プログラムを調べるコマンド w(here) スタックトレースを表示、矢印は現在のフレームを表す u(p) スコープを関数の呼び出し元に移す (o…