From e7541b7deff38a74fe454f3b031ad013f71155ee Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Sat, 22 Mar 2008 23:05:17 +0000 Subject: Made dom query results addable per QPID-870. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@640117 13f79535-47bb-0310-9956-ffa450edef68 --- python/mllib/dom.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'python') diff --git a/python/mllib/dom.py b/python/mllib/dom.py index 7c759dbdd5..df2b88322a 100644 --- a/python/mllib/dom.py +++ b/python/mllib/dom.py @@ -185,7 +185,24 @@ class Comment(Leaf): ## Query Classes ## ########################################################################### -class View: +class Adder: + + def __add__(self, other): + return Sum(self, other) + +class Sum(Adder): + + def __init__(self, left, right): + self.left = left + self.right = right + + def __iter__(self): + for x in self.left: + yield x + for x in self.right: + yield x + +class View(Adder): def __init__(self, source): self.source = source -- cgit v1.2.1