On Tue, Apr 25, 2017 at 4:31 PM, Erik <python@lucidity.plus.com> wrote:
On 25/04/17 22:15, Brice PARENT wrote:
it may be easier to get something like this
(I think, as there is no new operator involved) :

No new operator, but still a syntax change, so that doesn't help from that POV.


def __init__(self, *args, **kwargs):
      self.* = *args
      self.** = **kwargs

What is "self.* = *args" supposed to do? For each positional argument, what name in the object is it bound to?

E.

For what it's worth, that's what I don't really like about the initially proposed syntax too ...

    self .= foo, bar, baz

works OK, but:

    tup = foo, bar, baz
    self .= tup

doesn't work.  Admittedly, that could be part of the definition of this feature, but it feels really unexpected to all of a sudden give my tuple a temporary name and have the code behave in a dramatically different fashion.
 

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/



--

Matt Gilson | Pattern

Software Engineer

getpattern.com