Skip to main content
deleted 9 characters in body
Source Link
Géry Ogam
  • 8.4k
  • 5
  • 53
  • 89

This will bind self to handler:

bound_handler = lambda *args, **kwargs: handler(self, *args, **kwargs) 
bound_handler = lambda *args, **kwargs: handler(self, *args, **kwargs) 

This works by passing self as the first argument to the function. objectobj.functionf() is just syntactic sugar for functionf(objectobj).

This will bind self to handler:

bound_handler = lambda *args, **kwargs: handler(self, *args, **kwargs) 

This works by passing self as the first argument to the function. object.function() is just syntactic sugar for function(object).

This will bind self to handler:

bound_handler = lambda *args, **kwargs: handler(self, *args, **kwargs) 

This works by passing self as the first argument to the function. obj.f() is just syntactic sugar for f(obj).

Source Link
brian-brazil
  • 34.5k
  • 7
  • 104
  • 94

This will bind self to handler:

bound_handler = lambda *args, **kwargs: handler(self, *args, **kwargs) 

This works by passing self as the first argument to the function. object.function() is just syntactic sugar for function(object).