Twitterより転載 shimizukawa: あるあるw あわせて覚えたい:関数引数のデフォルト値に arg=[] したときの挙動 RT @nishio: @atsuoishimoto 正しいけど不親切だと思ったので補足しました: 同じ値がN個入っているリストの作り方 http://bit.ly/eW2oaF はいはい、じゃあそれも書いておきましょう! Pythonの長所の一つはdisでバイトコードが読めることだと思うので疑問に思ったらとりあえずみんなdisればいいとおもうよ! >>> import dis >>> def bar(): ... def foo(x=1, y=2, z=[]): ... pass ... >>> dis.dis(bar) 2 0 LOAD_CONST 1 (1) 3 LOAD_CONST 2 (2) 6 BUILD_LIST 0 9 LOAD_CONST