[XML-SIG] Py-ish PySax Suggestion #2
uche.ogbuji@fourthought.com
uche.ogbuji@fourthought.com
Mon, 26 Apr 1999 23:56:19 -0600
> I would like to suggest that we copy the *mllib start_foo convention for
> PySAX. Here's what a HandlerBase.StartElement would look like for that:
>
> def startElement( self, tagname, attrs ):
> method = getattr( self, "start_"+tagname, None)
> if method:
> method( attrs )
> else:
> self.startUnknownElement( tagname, attrs )
>
> def endElement( self, tagname, attrs ):
> method = getattr( self, "end_"+tagname, None)
> if method:
> method()
> else:
> self.startUnknownElement( tagname )
>
>
> def startUnknownElement( self, tagname, attrs ):
> pass
>
> def endUnknownElement( self, tagname ):
> pass
I don't have a big problem with this, but I'll bet it gives fits to those
about these parts who are very concerned with every last bit of run-time speed.
And indeed, since this is so easily achieved under the current PySAX, is there
really a need to enforce the meta-programming?
--
Uche Ogbuji
FourThought LLC, IT Consultants
uche.ogbuji@fourthought.com (970)481-0805
Software engineering, project management, Intranets and Extranets
http://FourThought.com http://OpenTechnology.org