Open ionelmc opened 4 years ago
state[event.code, name] = id(event.locals[name])
state[event.code, name, attr] = id(event.locals[name].__dict__[attr])
for name in event.locals: if type(event.locals[name]).__name__ == klass: state[klass, attr] = id(event.locals[name].__dict__[attr])
for name in event.locals: state[event.code, name] = id(event.locals[name])
state[id(inst), attr] = id(inst.__dict__[attr])
Trigger condition: state[<criteria>] != new_id and (value(new_value) if callable(value) else value == new_value)
. Need to note that value == new_value
is a potentially dangerous side-effect incurring operation.
There's VarsPrinter and VarsSnooper but they can't handle well this usecase: find out when a specific field or variable changes, perhaps even to a certain value.
Some ideas for a predicate:
Usecases like this one https://stackoverflow.com/a/54536941/23658 could be supported like this:
All the options and alternative names:
There is a question of disallowing
name
andobject
at the same time. Perhaps allow it but make it mean "if object isobject
and variable name isname
".Another problem is if
type
is a string or the actual type.