[Python-ideas] Assignment decorators (Re: The Descriptor Protocol...)

Dj Gilcrease digitalxero at gmail.com
Wed Mar 9 22:57:54 CET 2011

On Mon, Mar 7, 2011 at 10:50 PM, Raymond Hettinger
<raymond.hettinger at gmail.com> wrote:
> Just for the fun of it, here's my offering:
>    a := gizmo(arg1, arg2)
> is equivalent to
>    a = gimzo(arg1, arg2, __name__='a')

Why not just use the normal decorator syntax where assignment
decorators must have the following signature

def attr_dec(obj, left, right): ...

and leave it up to the specific attribute decorator to decide how it
handles the various assignment types. This is a much more general
purpose syntax that would let you achieve the goal of name passing as
well as more.

More information about the Python-ideas mailing list