Author Digitalxero
Recipients Digitalxero
Date 2009-08-06.03:35:15
SpamBayes Score 1.17944e-07
Marked as misclassified No
Message-id <1249529720.45.0.62463367335.issue6655@psf.upfronthosting.co.za>
In-reply-to
Content
I recently converted a project from using a custom  implementation of 
xml.dom.minidom to using EelemntTree that comes with python2.5+ and 
found myself wishing for a find(tag_or_path) method that would do so iteratively instead of just on the current elements direct children. 
This is possible with the code as written;

looking_for = None
for el in etree.getiterator(tag_or_path):
    looking_for = el
    break

I have to do this type of action so often in my code that I just decided 
to grab the python implementation of etree that came with py2.6 and 
include it with my app and patch in an iter_find method as the instant 
break for loop is just asking for maintenance issues down the road what 
I forget why I was breaking on the first loop no matter what.
History
Date User Action Args
2009-08-06 03:35:20Digitalxerosetrecipients: + Digitalxero
2009-08-06 03:35:20Digitalxerosetmessageid: <1249529720.45.0.62463367335.issue6655@psf.upfronthosting.co.za>
2009-08-06 03:35:18Digitalxerolinkissue6655 messages
2009-08-06 03:35:17Digitalxerocreate