Guido van Rossum wrote:

> try:
>   hash(x)
> except TypeError:
>   # apparently x is not hashable
> 
> then you're also swallowing any type errors in the computation of a
> legitimate hash function.

Maybe it would help if there were a specific exception,
such as NotHashableError, that hash functions were
expected to raise in this situation instead of a
generic TypeError.

For backwards compatibility it could be a subclass
of TypeError.

--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to