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

"Martin v. Löwis" martin at v.loewis.de
Sat Aug 12 08:20:36 CEST 2006


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 often enough, you can write

def function(f):
  return lambda *args:f(*args)

Regards,
Martin


More information about the Python-Dev mailing list