diff options
author | Paul McGuire <ptmcg@austin.rr.com> | 2019-07-13 12:46:14 -0500 |
---|---|---|
committer | Paul McGuire <ptmcg@austin.rr.com> | 2019-07-13 12:46:14 -0500 |
commit | 7d96e569a1b5f4505dac8d6f24c4b27562acf875 (patch) | |
tree | 35ce035b64f8e11bead58ff0da1ffda1f43af99b | |
parent | b295bc146687924af0c51a56157808b528950599 (diff) | |
download | pyparsing-git-7d96e569a1b5f4505dac8d6f24c4b27562acf875.tar.gz |
Update `__eq__` to Py2/Py3 compat
-rw-r--r-- | pyparsing.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pyparsing.py b/pyparsing.py index 1d532af..5ca86b0 100644 --- a/pyparsing.py +++ b/pyparsing.py @@ -2556,9 +2556,12 @@ class ParserElement(object): # catch and re-raise exception from here, clears out pyparsing internal stack trace raise exc - def __eq__(self,other): + def __eq__(self, other): if isinstance(other, ParserElement): - super(ParserElement, self).__eq__(other) + if PY_3: + self is other or super(ParserElement, self).__eq__(other) + else: + return self is other or vars(self) == vars(other) elif isinstance(other, basestring): return self.matches(other) else: |