Behavior of a conditional breakpoint in Python when using assignment -
recently debugging code , inadvertently set conditional breakpoint following:
my_var = some_val
when in reality wanted
my_var == some_val
obviously not want got me curious behavior when debugging (and other things happen under hood). statement executed , stored? i.e. if first line used condition my_var
take on some_val
every time line come across?
i noticed because hit breakpoint "condition" evaluating true
.
was wondering happens beneath layer out of curiosity.
it evaluated not stored. reason because can overwrite __eq__
method, x == y
function call.
short example :
class a: def __eq__(self, other): print "evaluated !" = a() == 1 # prints "evaluated !"
Comments
Post a Comment