
At the C level, PyDict_Update(old, new) is just a shortcut for override=1 PyDict_Merge(old, new, override) C extensions can use PyDict_Merge directly with override=0, which keeps the current value in case of duplicate keys. Python code can only use update, which means that override is always true. Is there a good reason this? -jJ

[Jewett, Jim J]
At the C level,
PyDict_Update(old, new)
is just a shortcut for
override=1 PyDict_Merge(old, new, override)
It is today, but that's a relatively new internal ability; IIRC, Guido added it to help with the implementation of new-style classes.
C extensions can use PyDict_Merge directly with override=0, which keeps the current value in case of duplicate keys.
Yes.
Python code can only use update, which means that override is always true.
Yes.
Is there a good reason this?
Dunno -- define "good" <0.5 wink>.
participants (2)
-
Jewett, Jim J
-
Tim Peters