[Python-ideas] Augmented assignment syntax for objects.

Joao S. O. Bueno jsbueno at python.org.br
Wed Apr 26 08:19:34 EDT 2017


On 25 April 2017 at 19:30, Erik <python at lucidity.plus.com> wrote:
> And as I also said above, 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.

It is perfectly feasible to have a decorator to which you can simply
pass a list of not wanted auto-parameters, or that will just
auto-assign parameters that have been declared on the class body, or
even inspect the function signature and check for special annotations
- there are tens of ways we could spec a list of exceptions to such a
decorator, and still avouid typing three times each name.

That said, I am all in favor of the addition of such a decorator to the stdlib.

   js
  -><-


More information about the Python-ideas mailing list