[XML-SIG] Specializing DOM exceptions
Mike Olson
Mike.Olson@fourthought.com
Wed, 03 Jan 2001 10:09:50 -0700
uche.ogbuji@fourthought.com wrote:
>
> > On Sat, 23 Dec 2000 uche.ogbuji@fourthought.com wrote:
> >
> > > Seriously, after a quick survey of my code, the only place I import Node is in
> > > order to get at the constants.
> >
> > Yup, I noticed this in 4Suite code, and I kept wondering about the
> > rational of doing so, since almost every object you manipulate _is_ a
> > node, and therefore has access to the class attributes.
> > In other words a typical line of code is:
> > "if some_node.nodeType == Node.ELEMENT_NODE :"
> >
> > Is there a difference in performance with:
> > "if some_node.nodeType == some_node.ELEMENT_NODE :" ?
>
> Nope. It's all about developer's intertia, AKA cutnpasteitis.
Actually there may be a small performace advantage doing it they way it
is done. Looking it up from the instance it will have to look into
atleast 3 dictionaries to find the value, while looking it up from the
class itself it will only have to look into one dictionary. (though
this theroy is untested)
Mike
>
> --
> Uche Ogbuji Principal Consultant
> uche.ogbuji@fourthought.com +1 303 583 9900 x 101
> Fourthought, Inc. http://Fourthought.com
> 4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
> Software-engineering, knowledge-management, XML, CORBA, Linux, Python
>
> _______________________________________________
> XML-SIG maillist - XML-SIG@python.org
> http://www.python.org/mailman/listinfo/xml-sig
--
Mike Olson Principal Consultant
mike.olson@fourthought.com (303)583-9900 x 102
Fourthought, Inc. http://Fourthought.com
Software-engineering, knowledge-management, XML, CORBA, Linux, Python