[Python-3000] callable()

Guido van Rossum guido at python.org
Thu Jul 27 18:27:56 CEST 2006


So how about we change callable() and add hashable(), iterable() and
whatever else makes sense so that these all become like this:

  def callable(x):
    return getattr(x, "__call__", None) is not None

This way classes can explicitly declare that they aren't callable,
hashable, iterable etc. by setting the corresponding attribute to
None.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list