Stefan Behnel <[EMAIL PROTECTED]> writes: > So, if hashable() returns True, it means that a) the designer didn't > care about switching it off or b) there are cases where it works, so > it makes sense to try calling it.
If the code can successfully work with either hashable or non-hashable objects, it can just always try to call it (and deal with potential failure), rather than test first and then check for failure anyway. Let me repeat the question: what is hashable() useful for? Please describe how would you use it, and I will reply with how to do the same thing simpler, without hashable(), or why it was a bad idea to begin with. It's not much better with callable() and iterable(). The only use I can see is overloading (a parameter plays different roles depending on its type); the nature of these predicates makes this usage fragile (adding a seemingly unimportant __call__ definition to a class breaks code unnecessarily), and the roles should better be specified more explicitly. -- __("< Marcin Kowalczyk \__/ [EMAIL PROTECTED] ^^ http://qrnik.knm.org.pl/~qrczak/ _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com