Steve and I have different opinions, as to what the new behaviour of:
>>> d = dict()
>>> d[x=1, y=2] = 3
should be.
He prefers that the assignment fail with
TypeError: dict subscripting takes no keyword arguments
I prefer that the assignment succeed (and hence a new key-value pair is
added to 'd').
I think this is a important question to get right. And a pressing question.
If we choose unwisely now, it might be difficult to change our mind later
(particularly after the feature has been released).
To support his opinion, Steven wrote:
> Just because something is syntactically allowed doesn't mean it has to be
> given a meaning in all circumstances.
I completely agree with this statement. And I hope that Steven agrees with
the statement: Just because something can be semantically forbidden doesn't
mean that it should to be.
We have an opportunity to improve Python for the benefit of its users. I
think it would be helpful to have some concise statements on the benefits of
>>> d = dict()
>>> d[x=1, y=2] = 3
TypeError: dict subscripting takes no keyword arguments
And similarly, concise statements on the benefits of
>>> d = dict()
>>> d[x=1, y=2] = 3
>>> d[x=1, y=2]
3
By the way, I'd prefer that a problem seen in the one choice is instead
expressed as a benefit of the other.
To conclude, I'm pleased that this difference of opinion has emerged sooner
rather than later. I hope we have a discussion that leads to an improved
shared understanding.
I hope this message helps.
--
Jonathan
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/2MTOTJK3UGRAW3ANJTUT27PBLTBDHQ36/
Code of Conduct: http://python.org/psf/codeofconduct/