Michael Hoffman wrote:

That's what lambda does. But it's going away, you'll have to use def when it does, unless the language designers come up with something better.

Yeah, I'm using lamda now it works nicely/cleanly.

If a lot of the bindings are actually setting variables, you could do something like this:

def attrsetter(obj, name, 1):
    def _return_func(value):
        return setattr(obj, name, value)

    return _return_func

bind('a', attrsetter(foo, "var", 1))
bind('a', attrsetter(foo, "var", 2))

Ah, perfect. Thanks!

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to