[Python-checkins] r79808 - in python/trunk/Lib: functools.py test/test_functools.py
Nick Coghlan
ncoghlan at gmail.com
Mon Apr 5 21:05:03 CEST 2010
raymond.hettinger wrote:
> Modified: python/trunk/Lib/functools.py
> ==============================================================================
> --- python/trunk/Lib/functools.py (original)
> +++ python/trunk/Lib/functools.py Mon Apr 5 20:53:43 2010
> @@ -93,4 +93,6 @@
> return mycmp(self.obj, other.obj) >= 0
> def __ne__(self, other):
> return mycmp(self.obj, other.obj) != 0
> + def __hash__(self):
> + raise TypeError('hash not implemented')
> return K
Including "__hash__ = None" in the class definition is a better way to
say that (throwing a type error manually like this will confuse
collections.Hashable).
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
More information about the Python-checkins
mailing list