On 2/20/06, Dan Gass <[EMAIL PROTECTED]> 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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to