[Python-ideas] Augmented assignment syntax for objects.

Erik python at lucidity.plus.com
Wed Apr 26 10:59:15 EDT 2017


On 26/04/17 13:19, Joao S. O. Bueno wrote:
> On 25 April 2017 at 19:30, Erik <python at lucidity.plus.com> wrote:
>> decorators don't cut it anyway (at least not those
>> proposed) because they blindly assign ALL of the arguments. I'm more than
>> happy to hear of something that solves both of those problems without
>> needing syntax changes though, as that means I can have it today ;)
>
> Sorry -  a decorator won't "blindly assign all argments" - it will do
> that just if it is written to do so.

Right, and the three or four variants suggested (and the 
vars(self).update() suggestion) all do exactly that. I was talking about 
the specific responses (though I can see my language is vague).

[FWIW I've been using Python the whole time that decorators have existed 
and I've yet to need to write one - I've _used_ some non-parameterized 
ones though - so I guess I'd forgotten that they can take parameters]

E.


More information about the Python-ideas mailing list