On 23 окт, 00:26, Bruno Desthuilliers
<[EMAIL PROTECTED]> wrote:
> netimen a écrit :
> (snip)
>
> > OK, I have implemented Bruno Desthuilliers example. But there is
> > another question: can I having a method determine if it is an instance
> > of given class. So:
>
> As the name imply, a method is
netimen a écrit :
(snip)
OK, I have implemented Bruno Desthuilliers example. But there is
another question: can I having a method determine if it is an instance
of given class. So:
As the name imply, a method is usually, well, an instance of type
'method' !-)
class Obj(object):
(snip)
cl
On 23 окт, 00:34, Terry Reedy <[EMAIL PROTECTED]> wrote:
> George Sakkis wrote:
> > On Oct 22, 12:13 pm, netimen <[EMAIL PROTECTED]> wrote:
>
> >> Can I substitute a method of a class by a callable object (not a
> >> function)? I can very easy insert my function in a class as a method,
> >> but an
George Sakkis wrote:
On Oct 22, 12:13 pm, netimen <[EMAIL PROTECTED]> wrote:
Can I substitute a method of a class by a callable object (not a
function)? I can very easy insert my function in a class as a method,
but an object - can't.
I have the following:
class Foo(object):
pass
class O
On 22 окт, 20:46, Bruno Desthuilliers
<[EMAIL PROTECTED]> wrote:
> netimen a écrit :
>
> > Can I substitute a method of a class by a callable object (not a
> > function)? I can very easy insert my function in a class as a method,
> > but an object - can't.
>
> functions implement the descriptor pro
netimen a écrit :
Can I substitute a method of a class by a callable object (not a
function)? I can very easy insert my function in a class as a method,
but an object - can't.
functions implement the descriptor protocol so when looked up as class
attributes, the lookup invoke their __get__ met
On Oct 22, 12:13 pm, netimen <[EMAIL PROTECTED]> wrote:
> Can I substitute a method of a class by a callable object (not a
> function)? I can very easy insert my function in a class as a method,
> but an object - can't.
>
> I have the following:
>
> class Foo(object):
> pass
>
> class Obj(obje
netimen wrote:
Can I substitute a method of a class by a callable object (not a
function)? I can very easy insert my function in a class as a method,
but an object - can't.
Yes you can and did.
class Foo(object):
pass
class Obj(object):
def __call__(self, obj_self):
print 'Ob
Can I substitute a method of a class by a callable object (not a
function)? I can very easy insert my function in a class as a method,
but an object - can't.
I have the following:
class Foo(object):
pass
class Obj(object):
def __call__(self, obj_self):
print 'Obj'
def func(self)