calling __init__ more than once?

Roy Smith roy at panix.com
Sun Sep 2 18:55:55 EDT 2001


I've got a file parsing class which in which I call a single parser object 
repeatedly to parse additional files.  Something like:

   p = myParser()
   stuff1 = p.parse (fileName1)
   stuff2 = p.parse (fileName2)

Is there any reason why my parse method couldn't call __init__() to reset 
things back to the start state?  It feels kind of creepy, but I don't see 
any reason why it should be a problem.  Is there something I'm missing 
here, or is it really OK to call __init__() again?



More information about the Python-list mailing list