なぜか最近はpythonをいじってます。Rubyは・・・ちょっとお休み。
個人的なメモ。Pythonで関数呼び出しもとの情報を取得(web.pyのソースから)。
python code
import syssys._getframe(1).f_locals
ほうほう。
python code
def test_func() :print sys._getframe(1).f_localsa = "variable a"b = "variable b"c = 1test_func()#>> {'test_func': <function test_func at 0x40657684>, 'a': 'variable a', 'c': 1, 'b': 'variable b', .....}
こんな感じで。
No comments yet
trackback uriLeave a Comment