Message205015
Consider repeated executions of a code like this:
>tree = xml.etree.ElementTree.parse( full_name ) # many different files
>report_type = tree.getroot().attrib['Name'] # something changing
>tree.getroot().find( ".//t:Detail", {'t' : report_type} )
There is a _cache variable in \Lib\xml\etree\ElementPath.py:
>def iterfind(elem, path, namespaces=None):
> // ...
> try:
> selector = _cache[path]
> except KeyError:
> // ...
In my code I use the same path (".//t:Detail"), so no KeyError exception is raised and cached (the same) value is used, but full path should be different ('.//{url_one}Detail', './/{url_two}Detail', etc) depending on namespaces dictionary. |
|
Date |
User |
Action |
Args |
2013-12-02 15:18:46 | valeriy.nov | set | recipients:
+ valeriy.nov |
2013-12-02 15:18:46 | valeriy.nov | set | messageid: <1385997526.09.0.197144583843.issue19862@psf.upfronthosting.co.za> |
2013-12-02 15:18:46 | valeriy.nov | link | issue19862 messages |
2013-12-02 15:18:45 | valeriy.nov | create | |
|