On 8-mei-2006, at 8:58, Talin wrote:
And *how* exactly would you implement your isFunction test so as to detect the "naive, everyday concept of a function" that you seem to want, in a way that does any better job than the current callable()?This 'isFunction' test that I am thinking of would only return true foruser defined functions, built-in functions, and similar objects; Itwould not return true for classes or other objects that are technically functions in a mathematically pure sense, but which normal people don'tthink of as functions. In other words, a function that does what most people expect it to, by conforming to their intuitive idea of what a function is, rather thansome grammatical or mathematical definition. And in cases of ambiguity, it would be conservative, returning false negatives but not false positives.
But why would this be useful? Using objects with a __call__ method as afunction is useful at times (such as with callback functions or to remember
state). If isFunction would return false for such objects it is likely that such objects would be rejected at some places where I'd like to use them. Ronald
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ 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