[Python-Dev] Proposal: defaultdict (original) (raw)
Thomas Heller theller at python.net
Fri Feb 17 10:42:40 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?
Ok, setdefault is a horrible name. Would it make sense to come up with a better name?
Georg Brandl wrote:
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
You mean ordereddict, not sorteddict, I hope.
* keytransformdict, such as d = keytransformdict(str.lower).
Not sure what you mean by that.
What I would like is probably more ambitious: I want a dict that allows case-insensitive lookup of string keys, plus ideally I want to use it as class or instance dictionary. Use case: COM wrappers.
Thomas
- Previous message: [Python-Dev] Proposal: defaultdict
- Next message: [Python-Dev] Proposal: defaultdict
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]