Alex Martelli wrote:
jfj <[EMAIL PROTECTED]> wrote:

Then, without looking at the previous code, one can say that "x" is a
function which takes one argument.


One can say whatever one wishes, but saying it does not make it true.

One can say that x is a green frog, but that's false: x is a
boundmethod.

One can say that x is a function, but that's false: x is a boundmethod.

One can say that x is a spade, but that's false: x is a boundmethod.


I understand that a function and a boundmethod are *different* things. For one a *boundmethod* has the attributes im_self, im_class, which a function does not have (a green frog neither). Thus they are not the same thing.

HOWEVER, what I ask is WHY don't we set the tp_descr_get of
the boundmethod object to be the same as the func_descr_get???
Or WHY do they *have* to differ in this specific part?

I quickly looked at the source of python and it seems that a
one-liner would be enough to enable this. So it's not that it
would be hard to implement it, or inefficient.

A bound method would *still* be a boundmethod.
We could additionally have:

>>>type(x)
<boundmethod of <boundmethod of <boundmethod of....<__main__.A instance at 0x>>>


If there a good reason that the __get__ of a boundmethod does not
create a new boundmethod wrapper over the first boundmethod?


G. -- http://mail.python.org/mailman/listinfo/python-list

Reply via email to