calling __init__ more than once?

Emile van Sebille emile at fenx.com
Sun Sep 2 20:19:22 EDT 2001


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

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

HTH,

--

Emile van Sebille
emile at fenx.com

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