+1 on the idea, -1 on the syntax. i'm probably not a very skilled developer but i have found myself repeating variable names often enough that i've felt annoyed by it.
alex hall's syntax suggested syntax seems nice. would be fun to be able to write: >>> a=1 >>> b=2 >>> dict(*, a, b) {'a': 1, 'b': 2} > I think this is still pretty clear: > > self.do_something(positional, *, keyword, keyword1=somethingelse, > keyword2) > > but if you don't like that you can easily add a restriction that no > explicit keywords are allowed after *, so: > > self.do_something(positional, keyword1=somethingelse, *, keyword2, > keyword) > One note about that: since kwarg dictionaries are now officially ordered, it would be a little bit of a problem to disallow this: def f(*args, **kwargs): pass f(pos1, pos2, *, kw1, kw2, kw3=other) ...and require this instead: f(pos1, pos2, kw3=other, *, kw1, kw2) ...because then the syntax is forcing the order in the **kwargs dictionary to change. now you can't use the feature at all if the order is important.
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/QYC6F45ZFX2BX56ZJKY7FJOJNP7UUJIN/ Code of Conduct: http://python.org/psf/codeofconduct/