Martin v. Löwis wrote: > Guido van Rossum wrote: > >>Feedback? > > > I would like this to be part of the standard dictionary type, > rather than being a subtype. > > d.setdefault([]) (one argument) should install a default value, > and d.cleardefault() should remove that setting; d.default > should be read-only. Alternatively, d.default could be assignable > and del-able. > The issue with setting the default this way is that a copy would have to be created if the behavior was to differ from the sometimes-confusing default argument behavior for functions.
> Also, I think has_key/in should return True if there is a default. > It certainly seems desirable to see True where d[some_key] doesn't raise an exception, but one could argue either way. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/ _______________________________________________ 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