-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Fri, Feb 13, 2009 at 03:41:52PM +, MRAB wrote:
Berend van Berkum wrote:
Yes.. tested that and SGMLParser won't let me override __init__,
(SGMLParser vars are uninitialized even with sgmllib.SGMLParser(self)
call).
OK, so SGMLParser
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi everyone,
I read the source, made numerous tests, but SGMLParser's keeps returning *tag*
data
from previous parser instances. I'm totally confused why.. The content data it
returns is ok.
E.g.::
sp = MyParser()
sp.feed('testt
Berend van Berkum wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi everyone,
I read the source, made numerous tests, but SGMLParser's keeps returning *tag* data
from previous parser instances. I'm totally confused why.. The content data it
returns is ok.
E.g.::
sp = MyParser()
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Fri, Feb 13, 2009 at 02:31:40PM +, MRAB wrote:
Berend van Berkum wrote:
import sgmllib
class MyParser(sgmllib.SGMLParser):
content = ''
markup = []
span_stack = []
These are in the _class_ itself, so
Berend van Berkum wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Fri, Feb 13, 2009 at 02:31:40PM +, MRAB wrote:
Berend van Berkum wrote:
import sgmllib
class MyParser(sgmllib.SGMLParser):
content = ''
markup = []
span_stack = []
These are
you are declaring class variables, not instance variables. you need to
declare these in an __init__ method. RTFM.
http://docs.python.org/tutorial/classes.html#a-first-look-at-classes
Berend van Berkum wrote:
class MyParser(sgmllib.SGMLParser):
content = ''
markup = []
span_stack = []
Sorry, this reply was delayed (trying to use usenet...) and so now seems
(even more) bad tempered than needed. Andrew
andrew cooke wrote:
you are declaring class variables, not instance variables. you need to
declare these in an __init__ method. RTFM.