hubritic schrieb:
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
very pythonic.

What makes you believe that?

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?

Yes, by Daddy telling him so. That's how nature does it, and how you should do it. Or do you think that because DNA-tests are available to us we should just put all kids into a big pool and make them find out who their parents are themselves, once they grew up?

Diez
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to