[Python-ideas] A bind protocol (was Re: New __reference__ hook)

Eric Snow ericsnowcurrently at gmail.com
Wed Dec 5 21:40:44 CET 2012


(from the "Re: New __reference__ hook" thread)

On Wed, Dec 5, 2012 at 11:54 AM, Bruce Leban <bruce at leapyear.org> wrote:
> There is another way to write expressions that don't get evaluated:
>
> lambda: a*x + b*y + c
>
>
> So you could write this as z.bind(lambda: rhs) or if this is important
> enough there could be a new bind operator:
>
> lhs @= rhs
>
>
> which is equivalent to
>
> lhs.__bind__(lambda: rhs)

The lazy/lambda part aside, such an operator would somewhat help with
performance concerns and allow the "binder" to control when the
"bindee" gets notified.

-eric



More information about the Python-ideas mailing list