I was wondering that if there are so many arguments to a function that it *looks* ugly, that it might just *be* ugly. 

For one, too many required arguments to a function (constructor, whatever) is already strange. Binding them as attributes of the object, unmodified in a constructor also seems to be rare. Matplotlib, for example, might take 8 (optional keyword) arguments for a Figure (https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/figure.py#L268), but then at a bare minimum, the vertical space required is *doubled* by the need for pesky if-blocks and logic. Self-assignment is a pittance.

Are there any better examples of where adding new syntax could help readability for programmers, both new and old?

On Wed, Apr 26, 2017 at 9:59 AM, Erik <python@lucidity.plus.com> wrote:
On 26/04/17 13:19, Joao S. O. Bueno wrote:
On 25 April 2017 at 19:30, Erik <python@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]


Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/