HTMLParser problems.

John J. Lee jjl at pobox.com
Fri Oct 31 16:36:47 EST 2003


"Sean Cody" <sean at -[NOSPAMPLEASE]-tfh.ca> writes:

> > > I could try:
> > >         def handle_entityref(self,entity):
> > >                 if self.in_td == 1:
> > >                     if entity == "nbsp":
> > >                         self.row.append(-1)
> > >
> > > But that seems ulgy... (comments?).
> >
> > Does this work?  For me, that comes first.
> >
> Actually yes it does.
> 
> I wonder if there is a better way as I'm just stumbling through the
> HTMLParser class.
[...]

Seems OK to me.


> I use a lot of member variables. Is there a way to not have to reference
> members by self.member.  Back in the day in pascal you could do stuff like
> "with self begin do_stuff(member_variable); end;" which was extremely useful
> for large 'records.'

Well, obviously, there's:

    mv = self.member_variable
    do_stuff(mv)


or if you have lots of names that are annoying you, things like:

    for name in "foo", "bar", "baz":
        do_stuff(getattr(self, name))


can help.


John




More information about the Python-list mailing list