diff options
author | Rafael H. Schloming <rhs@apache.org> | 2008-03-22 23:05:17 +0000 |
---|---|---|
committer | Rafael H. Schloming <rhs@apache.org> | 2008-03-22 23:05:17 +0000 |
commit | e7541b7deff38a74fe454f3b031ad013f71155ee (patch) | |
tree | d4ca07e4e80c745f5f3b9a1569c77218f2c71e24 /python/mllib/dom.py | |
parent | d8708b797ed7fe8a2cdb3625d0ee04927f4c0fe3 (diff) | |
download | qpid-python-e7541b7deff38a74fe454f3b031ad013f71155ee.tar.gz |
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
Diffstat (limited to 'python/mllib/dom.py')
-rw-r--r-- | python/mllib/dom.py | 19 |
1 files changed, 18 insertions, 1 deletions
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 |