You don't need anything like the bind
call the Javascript code involves. Javascript method binding doesn't work like Python method binding.
In Javascript, when you do thing.method(stuff)
, formally, the thing.method
expression resolves to what the standard calls a Reference, which carries both the function and the information that this
should be thing
. The information about what this
should be is used when you do thing.method(stuff)
, but it's discarded if you pass thing.method
as a callback or do pretty much anything else with it. The bind
call is needed to preserve the information about this
.
In Python, instead of the "Reference" stuff, thing.method
resolves to a bound method object, which carries the information about self
in the object itself. This information is not discarded, whether you call the method immediately, save it to a variable, pass it to another function as a callback, or do whatever else with it. Nothing like bind
is needed.