calling __init__ more than once?

Emile van Sebille emile at
Mon Sep 3 02:19:22 CEST 2001

One thing you could try is to restructure slightly, passing the filename on

stuff1 = myParser(fileName1)
stuff2 = myParser(fileName2)



Emile van Sebille
emile at

"Roy Smith" <roy at> wrote in message
news:roy-5FC394.18555502092001 at
> 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