[Python-Dev] Proposal: dict.with_values(iterable)
Steve Dower
steve.dower at python.org
Mon Apr 22 22:21:41 EDT 2019
More information about the Python-Dev mailing list
Mon Apr 22 22:21:41 EDT 2019
- Previous message (by thread): [Python-Dev] Proposal: dict.with_values(iterable)
- Next message (by thread): [Python-Dev] Proposal: dict.with_values(iterable)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 22Apr2019 1822, Glenn Linderman wrote: > Inada is now proposing a way to allow the coder to suggest a group of > dictionaries that might benefit from the same gains, by preclassifying > non-__dict__ slot dictionaries to do similar sharing. > > CSV reader is an exemplary candidate, because it creates groups of dicts > that use the same keys. (column names). I have other code that does > similar things, that would get similar benefits. > > Seems like since it is just an interface to existing builtin code, that > the one interface function (or dictionary factory class) could just as > well be a builtin function, instead of requiring an import. Sounds like a similar optimisation to sys.intern() is for strings. I see no reason to try and avoid an import here - it's definitely a special-case situation - but otherwise having a function to say "clone and update this dict" that starts by sharing the keys in the same way that __dict__ does (including the transformation when necessary) seems like an okay addition. Maybe copy() could just be enabled for this? Cheers, Steve
- Previous message (by thread): [Python-Dev] Proposal: dict.with_values(iterable)
- Next message (by thread): [Python-Dev] Proposal: dict.with_values(iterable)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list