How to watch for a variable change in python without dunder setattr or pdb

前端 未结 5 716
南方客
南方客 2020-12-05 05:44

There is large python project where one attribute of one class just have wrong value in some place.

It should be sqlalchemy.orm.attributes.InstrumentedAttribute, but

5条回答
  •  -上瘾入骨i
    2020-12-05 06:10

    def __setattr__(self, name, value):
        if name=="xxx":
           util.output_stack('xxxxx')
        super(XXX, self).__setattr__(name, value)
    

    This sample code helped me.

提交回复
热议问题