Re: Why require __init__ to return None?

Donald Beaudry (don@vicorp.com)
Fri, 27 May 94 15:30:34 EDT

>>>>> On Fri, 27 May 1994 14:56:46 -0400, "Steven D. Majewski" <sdm7g@elvis.med.virginia.edu> said:

> If an method "__func__" is defined for a class, then syntactically
> calling an instance ( instance( ) ) would be equivalent to calling
> instance.__func__().

This point brings up an interesting question. That is, why can't any
built-in type over load the function call operator? The current
implementation of the call_object() routine is full of special cases,
one for each of the callable types. It seems to me that a cleaner
solution is to provide a new field in the type structure that holds
function pointer to be called for any type that wants to over load the
function call operator. Then, adding the behavior mentioned above
would not only be obvious, but would also be simple.

I have created a few new types for which I needed (o.k. wanted) to
over load the function call operator, so I did exactly what I
suggested above (and I keep redoing it for each release). If anyone
wants the patch, just let me know.

--Don
______ ______
\_\_\_\ /#/#/#/
\_\_\_\ ______
\_\_\_V#/#/#/ Donald Beaudry don@vicorp.com
\_\_/#/#/#/ V. I. Corporation uunet!vicorp!don
\_/#/#/#/ 47 Pleasant Street PHONE: (413) 586-4144
V#/#/#/ Northampton, MA 01060 FAX: (413) 586-3805