Python Tips: PDB で property で break。
Python Tips: PDB で property で break。
JRF 2022年5月17日
<pre>
class A:
@property
def bar(self):
return "OK"
a = A()
import pdb; pdb.set_trace()
a.bar
</pre>
…として、a.bar に breakpoint を設定したい場合、
JRF 2022年5月17日
<pre>
(Pdb) b A.bar.fget
</pre>
…とすればよい。
JRF 2022年5月17日
こうしないと次のようなエラーが出る。
<pre>
(Pdb) b a.bar
*** The specified object 'a.bar' is not a function or was not found along sys.path.
</pre>
JRF 2022年5月17日