On 2/20/06, Dan Gass <dan.gass at gmail.com> wrote: > Why not have the factory function take the key being looked up as an > argument? Seems like there would be uses to customize the default based on > the key. It also forces you to handle list factory functions and constant > factory functions (amongst others) to be handled the same way: > > d.default_factory = lambda k : list() > d.default_factory = lambda k : 0 Guido's currently backing "a subclass that implements __getitem__() calling on_missing() and on_missing() ... calling default_factory unless it's None". I think for 90% of the use-cases, you don't need a key argument. If you do, you should subclass defaultdict and override the on_missing() method. STeVe -- Grammar am for people who can't think for myself. --- Bucky Katt, Get Fuzzy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4