Who is your daddy: Can I find what object instantiates another object?
colinlandrum at gmail.com
Mon Apr 13 18:53:04 CEST 2009
I want to build a parser object that handles two different log file
formats. I have an object that handles Connection logs and an object
for Filter logs. Each will instantiate a Parser object, passing in
the path to individual log files.
There are a number of ways I could figure out whether I am dealing
with connection or filter log.
I could pass it in when creating the Parser, but that doesn't seem
I could figure out the type of log file a particular instance of the
Parser is working with by looking at the format of the file. This
wouldn't be hard but it seems unnecessary.
It would be jiffy if I could find what kind of object instantiated
that particular parser. So if a FilterLog object instantiated it, the
parser would know to parse a Filter log.
Can the Parser object know who its Daddy is?
More information about the Python-list