[Python-ideas] Have dict().update() return its own reference.
Guido van Rossum
guido at python.org
Fri Apr 20 18:21:50 CEST 2012
On Fri, Apr 20, 2012 at 8:00 AM, Alexander Belopolsky
<alexander.belopolsky at gmail.com> wrote:
> On Fri, Apr 20, 2012 at 10:49 AM, Stefan Behnel <stefan_ml at behnel.de> wrote:
>>> >>> a = {}
>>> >>> b = {1:2}
>>> >>> dict(a, **b)
>>> {1: 2}
>>
>> That's no guaranteed behaviour, though. It doesn't work in PyPy, for example.
>
> I seem to recall that CPython had a similar limitation in the past,
> but it was removed at some point. I will try to dig out the relevant
> discussion, but I think the consensus was that ** should not attempt
> validate the keys.
The should be strings. There is no requirement that they are valid identifiers.
--
--Guido van Rossum (python.org/~guido)
More information about the Python-ideas
mailing list