From e3d5ecc57975b2a168bc436efd90bc3223f1b4e7 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 26 Oct 2006 08:10:35 +0000 Subject: Reverse the relationship between __contains__ and has_key in all cache classes since python handles the "in" operator more efficiently than a has_key method call. svn path=/main/trunk/; revision=4821 --- pym/cache/template.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pym/cache/template.py') diff --git a/pym/cache/template.py b/pym/cache/template.py index 565e7d2ab..a628b1161 100644 --- a/pym/cache/template.py +++ b/pym/cache/template.py @@ -89,7 +89,7 @@ class database(object): raise NotImplementedError def has_key(self, cpv): - raise NotImplementedError + return cpv in self def keys(self): return tuple(self.iterkeys()) @@ -114,7 +114,7 @@ class database(object): raise NotImplementedError def __contains__(self, cpv): - return self.has_key(cpv) + raise NotImplementedError def get(self, k, x=None): try: -- cgit v1.2.3-1-g7c22