On 7/26/06, Andrew Koenig <[EMAIL PROTECTED]> wrote: > In other words, the current notion appears to be: > > An object is callable iff it has a __call__ attribute. > > An object is hashable iff its __hash__ attribute is not None. > > This example only strengthens my original intuition that if it is desirable > to check whether an object has a given property, the way of doing so should > be uniform across different properties. In other words, if the notion of > checking for a property is useful, there should be a single abstraction for > doing that check.
I'd be happy to extend the convention to all such attributes -- setting it to None to mean that the subclass doesn't want to provide it. That's clean, can't possibly be interpreted to mean anything else, and doesn't require you to actually call the attribute. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ 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