[XML-SIG] Specializing DOM exceptions

Mike Olson Mike.Olson@fourthought.com
Wed, 03 Jan 2001 11:56:40 -0700


"Fred L. Drake, Jr." wrote:
> 
> Mike Olson writes:
>  > 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,
>   It doesn't quite work like that -- looking it up from the class only
> takes one dict lookup *once you have the class*, but you are also
> doing one lookup for the class itself, assuming you've imported it
> into your module's globals.  

Of course, I realized after I saw Martin's response.  That's what I get
for answering email before coffee.


Mike

So the difference is a single dictionary
> lookup for each level of class derivation from Node.  For interned
> strings, this is pretty trivial and you can reasonably expect it to
> disappear in the wash.
>   On the other hand, picking it up from the class does assure you know
> the exact access path, and some people think it's more readable.
> "from xml.dom import Node" is your friend.  ;-)
> 
>   -Fred
> 
> --
> Fred L. Drake, Jr.  <fdrake at acm.org>
> PythonLabs at Digital Creations

-- 
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