Op 2017-09-25, Stefan Ram schreef :
> So, is there some mechanism in Python that can bind a method
> to an object so that the caller does not have to specify the
> object in the call?
>
> If so, how is this mechanism called?
>
Others have already explained the
Thomas Jollans wrote:
When an object is
constructed from a class, all functions in the class are turned into
method objects that refer back to the original object.
That's not quite true. Nothing is done to the methods at
the time an instance is created; rather, a bound method
object is created
On 26/09/17 01:04, Thomas Jollans wrote:
>
> In [1]: class C:
>
>...: def m(self):
>
>...: return True
I'll have to give my MUA a stern talking to about the importance of
whitespace. Anyway, you know what I mean.
>
>...:
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, Sep 26, 2017 at 8:49 AM, Stefan Ram wrote:
> |>>> from random import randint
> |
> |>>> randint
> |>
> |
> |>>> randint.__self__
> |
> |
> |>>> randint( 2, 3 )
> |2
>
> It seems I am calling the method »randint« of the object at
> »0x389798«, but I do not have