summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Blum2012-11-23 12:53:19 -0800
committerJosh Blum2012-11-23 12:53:19 -0800
commit432e5294b477b782108de72d85f9f7f95961698b (patch)
tree3c4a14c8230e488aea2592d9d42861f4f9f68df1
parent84ff7046d02ac597fb1fabc8be4691a8a13246e2 (diff)
downloadsandhi-432e5294b477b782108de72d85f9f7f95961698b.tar.gz
sandhi-432e5294b477b782108de72d85f9f7f95961698b.tar.bz2
sandhi-432e5294b477b782108de72d85f9f7f95961698b.zip
Element __eq__ in python/checks isinstance
-rw-r--r--include/gras/element.i9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/gras/element.i b/include/gras/element.i
index dfe4852..ed21367 100644
--- a/include/gras/element.i
+++ b/include/gras/element.i
@@ -30,10 +30,17 @@
return ($self)->to_string();
}
- bool __eq__(const Element &rhs) const
+ bool _equal(const Element &rhs) const
{
return ($self)->get() == rhs.get();
}
+
+ %insert("python")
+ %{
+ def __eq__(self, rhs):
+ if not isinstance(rhs, Element): return False
+ return self._equal(rhs)
+ %}
}
#endif /*INCLUDED_GRAS_ELEMENT_I*/