On 8/13/2014 5:51 AM, Chris Angelico wrote:
On Wed, Aug 13, 2014 at 7:06 PM, GregS wrote:
When I assign the reference as a class variable, the reference has __self__
set, too, so I get an extra argument passed to the function. If I assign
the reference as an instance variable, then __self__ is
On Wed, Aug 13, 2014 at 11:12 PM, Steven D'Aprano
wrote:
> Chris Angelico wrote:
>
>> The bound method object stores a reference to the original object (the
>> thing that becomes the first argument to the target function) in
>> __self__ (and the function in __func__). ISTM this ought to be _self
>
Chris Angelico wrote:
> The bound method object stores a reference to the original object (the
> thing that becomes the first argument to the target function) in
> __self__ (and the function in __func__). ISTM this ought to be _self
> (and _func), as it's intended to be private;
Why do you say th
On 8/13/14 5:51 AM, Chris Angelico wrote:
On Wed, Aug 13, 2014 at 7:06 PM, GregS wrote:
When I assign the reference as a class variable, the reference has __self__
set, too, so I get an extra argument passed to the function. If I assign
the reference as an instance variable, then __self__ is u
On Wed, Aug 13, 2014 at 8:20 PM, GregS wrote:
> Thanks to both of you for your incredibly prompt replies. My homework for
> tonight is to digest the descriptor protocol...
>
> Peter, thanks for suggesting using staticmethod() to get the behaviour I was
> expecting. I've only used staticmethod as
Thanks to both of you for your incredibly prompt replies. My homework
for tonight is to digest the descriptor protocol...
Peter, thanks for suggesting using staticmethod() to get the behaviour
I was expecting. I've only used staticmethod as a decorator before now.
Chris, I agree that it's n
On Wed, Aug 13, 2014 at 7:06 PM, GregS wrote:
> When I assign the reference as a class variable, the reference has __self__
> set, too, so I get an extra argument passed to the function. If I assign
> the reference as an instance variable, then __self__ is unset so no extra
> argument.
Spin-off
On Wed, Aug 13, 2014 at 7:06 PM, GregS wrote:
> If you look at i.ref.__self__ for the two cases, you'll see what's going on.
> I've tried RTFMing but can't find the reason for the two behaviours. Could
> someone provide an explanation for me, please?
What you're seeing there is the magic of inst
GregS wrote:
> Hello,
>
> This is my first post here so please gently inform me of any etiquette
> breaches.
>
> I'm seeing a behaviour I can't explain with Python 3.4.1 when I call a
> function via a reference stored in an object.
>
> When I assign the reference as a class variable, the refere
Hello,
This is my first post here so please gently inform me of any etiquette
breaches.
I'm seeing a behaviour I can't explain with Python 3.4.1 when I call a
function via a reference stored in an object.
When I assign the reference as a class variable, the reference has
__self__ set, too,
10 matches
Mail list logo