From 5ad5b09e3e01d499b07088085fc06d7b36245f2f Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sat, 23 Sep 2017 19:10:41 -0500 Subject: [PATCH] Add an identity check to LoopKernel.__eq__ This is going to make pytools!4 more useful, by avoiding expensive checks for the in-memory cache. --- loopy/kernel/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/loopy/kernel/__init__.py b/loopy/kernel/__init__.py index 084c37b45..4e2819a82 100644 --- a/loopy/kernel/__init__.py +++ b/loopy/kernel/__init__.py @@ -1474,6 +1474,9 @@ class LoopKernel(ImmutableRecordWithoutPickling): return hash(key_hash.digest()) def __eq__(self, other): + if self is other: + return True + if not isinstance(other, LoopKernel): return False -- GitLab