thomas coopman wrote:
> On Sat, 10 Feb 2007 09:04:15 -0500
> Kent Johnson <[EMAIL PROTECTED]> wrote:
>> If you do want to keep FooList then you should call
>> SortedList.__init__() to set the compare function.
>> SortedList.__init__ is an unbound function so you call it like this:
>>SortedLis
On Sat, 10 Feb 2007 09:04:15 -0500
Kent Johnson <[EMAIL PROTECTED]> wrote:
> thomas coopman wrote:
> >
> > also,
> > Is it better to use super in FooList? and how should I use it then?
>
> Actually I would say that FooList is not pulling its weight.
> SortedList already allows specialization by
thomas coopman wrote:
> Thank you for the explanation of bound and unbound methods.
> I understand that it is more common to use a bound method, but I don't
> think that I can use this because at the time I save the method, I don't
> know anything about the instances.
That would be an appropriate
On Sat, 10 Feb 2007 07:55:54 -0500
Kent Johnson <[EMAIL PROTECTED]> wrote:
> thomas coopman wrote:
> > Hi,
> >
> > I want to do something like this, don't know how to properly
> > explain it, so I just give you some example code
> >
> class Foo(object):
> def method(self, arg):
>
Hi Thomas,
thomas coopman wrote:
> I want to execute the class method given as argument,
> but this obvious doesn't work, but I don't know how to
> get it work,
Pass the method reference of the class as argument, like this:
>>> class A(object):
... def __init__(self, x): self.x = x
...
thomas coopman wrote:
> Hi,
>
> I want to do something like this, don't know how to properly explain it,
> so I just give you some example code
>
class Foo(object):
def method(self, arg):
print arg
>
def doSomething(object, func):
object.func("test")
>
On Sat, 10 Feb 2007 22:10:52 +1000
Jonathan McManus <[EMAIL PROTECTED]> wrote:
> It's pretty easy to make this work, actually. The issue is in the
> "doSomething" method.
>
> > >>>class Foo(object):
> > >>> def method(self, arg):
> > >>> print arg
> >
> > >>>def doSomething(object, func)
Hi,
I want to do something like this, don't know how to properly explain it,
so I just give you some example code
>>>class Foo(object):
>>> def method(self, arg):
>>> print arg
>>>def doSomething(object, func):
>>> object.func("test")
>>>object = Foo()
>>>doSomething(object,