[Python-Dev] Proposal: defaultdict (original) (raw)
Georg Brandl g.brandl at gmx.net
Fri Feb 17 10:10:32 CET 2006
- Previous message: [Python-Dev] Proposal: defaultdict
- Next message: [Python-Dev] Proposal: defaultdict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido van Rossum wrote:
d = DefaultDict([])
can be written as simply d[key].append(value)
Feedback?
Probably a good idea, has been proposed multiple times on clpy. One good thing would be to be able to specify either a default value or a factory function.
While at it, other interesting dict subclasses could be:
- sorteddict, practically reinvented by every larger project
- keytransformdict, such as d = keytransformdict(str.lower).
Georg
- Previous message: [Python-Dev] Proposal: defaultdict
- Next message: [Python-Dev] Proposal: defaultdict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]