Re: [Python-Dev] 2.6 idea: a 'function' builtin to parallel classmethod and staticmethod

2006-08-14 Thread Nick Coghlan
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

Re: [Python-Dev] 2.6 idea: a 'function' builtin to parallel classmethod and staticmethod

2006-08-12 Thread Guido van Rossum
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

Re: [Python-Dev] 2.6 idea: a 'function' builtin to parallel classmethod and staticmethod

2006-08-11 Thread Nick Coghlan
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:

Re: [Python-Dev] 2.6 idea: a 'function' builtin to parallel classmethod and staticmethod

2006-08-11 Thread Martin v. Löwis
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

[Python-Dev] 2.6 idea: a 'function' builtin to parallel classmethod and staticmethod

2006-08-11 Thread Nick Coghlan
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