I am using the cool minipyro.py standalone script to learn about pyro internals. I was assuming it is a working standalone thus I was following it line by line to understand. However when I got to the code for the trace effect handler what I saw did not make any sense to me.
‘’’
class trace(Messenger):
def enter(self):
super().enter()
self.trace = OrderedDict()
return self.trace
# trace illustrates why we need postprocess_message in addition to process_message:
# We only want to record a value after all other effects have been applied
def postprocess_message(self, msg):
assert (
msg["type"] != "sample" or msg["name"] not in self.trace
), "sample sites must have unique names"
self.trace[msg["name"]] = msg.copy()
def get_trace(self, *args, **kwargs):
self(*args, **kwargs)
return self.trace
‘’’
It looks like it is missing the part that is adding enties to the OrderedDict.
Or am I missing something?