On Fri, Sep 02, 2011 at 12:17:48PM +1000, Steven D'Aprano wrote:
> Richard D. Moores wrote:
> >Thanks, James, from your ideas I've come up with this function as a
> >general test for hashibility of any object:
> >
> >def is_hashable(object):
> >    try:
> >        if hash(object):
> >            return True
> >    except TypeError:
> >        return False
> 
> No need for the "if hash" test, just try hash:

Er, except this was already discussed :) 

Sorry for the noise.


-- 
Steven

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to