summaryrefslogtreecommitdiff
path: root/astroid/tree/base.py
diff options
context:
space:
mode:
authorCeridwen <ceridwenv@gmail.com>2016-02-21 16:25:01 -0500
committerCeridwen <ceridwenv@gmail.com>2016-02-21 16:25:01 -0500
commit51bd977f064520f5efe2795e484d2c0728128e08 (patch)
tree236714776386c16d04cb9ea83c0e9148091a2da5 /astroid/tree/base.py
parent54e5ddc279c4281e1612380af67051734ae30064 (diff)
downloadastroid-git-51bd977f064520f5efe2795e484d2c0728128e08.tar.gz
Revise zipper tests for speed and to be more accurate about what is being tested
Diffstat (limited to 'astroid/tree/base.py')
-rw-r--r--astroid/tree/base.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/astroid/tree/base.py b/astroid/tree/base.py
index 58298b8d..dc5119e1 100644
--- a/astroid/tree/base.py
+++ b/astroid/tree/base.py
@@ -61,6 +61,26 @@ class NodeNG(object):
self.lineno = lineno
self.col_offset = col_offset
self.parent = parent
+
+ def __iter__(self):
+ for field in self._astroid_fields:
+ yield getattr(self, field)
+
+ # def __eq__(self, other):
+ # if self.__class__ is other.__class__:
+ # return (all(getattr(self, f) == getattr(other, f)
+ # for f in self._astroid_fields) and
+ # all(getattr(self, f) == getattr(other, f)
+ # for f in self._other_fields))
+ # else:
+ # return False
+
+ # def __ne__(self, other):
+ # return not self == other
+
+ # # Must be defined to retain object.__hash__, see
+ # # https://docs.python.org/3/reference/datamodel.html#object.__hash__
+ # __hash__ = object.__hash__
def infer(self, context=None, **kwargs):
"""main interface to the interface system, return a generator on inferred