[Python-Dev] dict.merge()? (original) (raw)
Tim Peters tim.one at comcast.net
Fri Apr 30 12:47:56 EDT 2004
- Previous message: [Python-Dev] dict.merge()?
- Next message: [Python-Dev] PEP 289 - Generator Expressions - Let's Move Forward
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Jewett, Jim J]
At the C level,
PyDictUpdate(old, new) is just a shortcut for override=1 PyDictMerge(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 PyDictMerge 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>.
- Previous message: [Python-Dev] dict.merge()?
- Next message: [Python-Dev] PEP 289 - Generator Expressions - Let's Move Forward
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]