[Python-3000] PEP 3100 Comments

Greg Ewing greg.ewing at canterbury.ac.nz
Mon May 8 15:17:44 CEST 2006


Talin wrote:

> This 'isFunction' test that I am thinking of would only return true for 
> user defined functions, built-in functions, and similar objects; It 
> would not return true for classes or other objects that are technically 
> functions in a mathematically pure sense, but which normal people don't 
> think of as functions.

But what would it return for a user-defined class
with a __call__  method?

And if the answer to that is "True", what would it return
for the following class:

   class AmIAFunctionOrNot(object):

     def __call__(self, *args, **kwds):
       raise TypeError("This object cannot be called.")

> In other words, a function that does what most people expect it to, by 
> conforming to their intuitive idea of what a function is,

Intuitive ideas are too fuzzy to translate into code.
A rigorous specification is needed.

--
Greg


More information about the Python-3000 mailing list