[Python-Dev] dict.addlist()

Kevin Jacobs jacobs at penguin.theopalgroup.com
Tue Jan 20 09:25:09 EST 2004

On Tue, 20 Jan 2004, Raymond Hettinger wrote:
> Here is anidea to kick around:
> Evolve and eventually replace dict.setdefault with a more specialized 
> method that is clearer, cleaner, easier to use, and faster.
>        d.addlist(k, v)   would work like   d.setdefault(k, []).append(v)

-1: I use .setdefault all the time with non-list default arguments.  

The dict interface is getting complex enough that adding more clutter will
make it even harder to teach optimal idiomatic Python to newbies.


Kevin Jacobs - Enterprise Systems Architect | What is an Architect? He designs
Consultant to The National Cancer Institute | a house for another to build
Dept. of Cancer Epidemiology and Genetics   | and someone else to inhabit.
V: (301) 954-0726  E: jacobske at mail.nih.gov |             -- William Kahan

More information about the Python-Dev mailing list