Guido van Rossum wrote:
> It ought to be called @instancemethod for a better analogy.
That's actually what I was originally going to suggest.
And then I changed my mind after wondering how I would answer the question
"Why don't I need to decorate functions with @instancemethod in order to use
t
It ought to be called @instancemethod for a better analogy.
PS Nick how's the book coming along? :-)
--Guido
On 8/11/06, Nick Coghlan <[EMAIL PROTECTED]> wrote:
> It's sometimes useful to be able to use an existing callable as a method of a
> new class. If the callable is a real function, this i
Martin v. Löwis wrote:
> Nick Coghlan schrieb:
>> It would be nice if there was a similar mechanism for normal instance
>> methods
>> as well:
>>
>>method = function(some_callable)
>>
>
> If you know you have to put something around it, what's wrong with writing
>
> method = lambda *args:
Nick Coghlan schrieb:
> It would be nice if there was a similar mechanism for normal instance methods
> as well:
>
>method = function(some_callable)
>
If you know you have to put something around it, what's wrong with writing
method = lambda *args:some_callable(*args)
If that happens of
It's sometimes useful to be able to use an existing callable as a method of a
new class. If the callable is a real function, this is easy. You just
including the following line in the class definition:
method = some_callable
However, callable objects without a function-like __get__ method ca