On Tue, Apr 25, 2017 at 11:08 AM, Erik <pyt...@lucidity.plus.com> wrote: > The suggestion therefore is: > > def __init__(self, foo, bar, baz, spam, ham): > self .= foo, bar, baz, spam, ham > > This is purely syntactic sugar for the original example: > > def __init__(self, foo, bar, baz, spam, ham): > self.foo = foo > self.bar = bar > self.baz = baz > self.spam = spam > self.ham = ham > > ... so if any of the attributes have setters, then they are called as usual. > It's purely a syntactic shorthand. Any token which is not suitable on the > RHS of the dot in a standard "obj.attr =" assignment is a syntax error (no > "self .= 1").
Bikeshedding: Your example looks a lot more like tuple assignment than multiple assignment. I'd rather it link more with the way that multiple assignment works: # simple multiple assignment a = b = c = d = e = 0 # object member assignment self .= foo .= bar .= baz .= spam .= ham The trouble is that this syntax is really only going to be used inside __init__. It's hard to justify new syntax for one purpose like this. So I'm swaying between -0 and +0.5 on this. ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/