Extending the original idea, IMHO it would make sense for the dict
constructor to create a new dictionary not only from several mappings, but
mixing mappings and iterables too.
Consider this example:
x = [(1, 'one')]
y = {2: 'two'}
Now: {**dict(x), **y}
Proposed: dict(x, y)
I think this extension makes the call ostensibly easier to read and grep. I
believe we are safe regarding compatibility issues, right?
What do you guys think?
On Wed, Apr 11, 2018 at 4:44 AM, Mike Miller
Ok, we can haggle the finer details and I admit once you learn the syntax it isn't substantially harder. Simply, I've found the dict() a bit easier to mentally parse at a glance. Also, to add I've always expected multiple args to work with it, and am always surprised when it doesn't.
Would never have thought of this unpacking syntax if I didn't know that's the way its done now, but often have to think about it for a second or two.
On 2018-04-10 22:22, Chris Angelico wrote:
On Wed, Apr 11, 2018 at 2:44 PM, Steven D'Aprano
wrote: On Wed, Apr 11, 2018 at 02:22:08PM +1000, Chris Angelico wrote:
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/