A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-February/061787.html below:

[Python-Dev] getdefault(), the real replacement for setdefault()

[Python-Dev] getdefault(), the real replacement for setdefault()Barry Warsaw barry at python.org
Fri Feb 24 15:22:19 CET 2006
On Feb 23, 2006, at 4:41 PM, Thomas Wouters wrote:

> On Wed, Feb 22, 2006 at 10:29:08PM -0500, Barry Warsaw wrote:
>> d.getdefault('foo', list).append('bar')
>
>> Anyway, I don't think it's an either/or choice with Guido's subclass.
>> Instead I think they are different use cases.  I would add  
>> getdefault()
>> to the standard dict API, remove (eventually) setdefault(), and add
>> Guido's subclass in a separate module.  But I /wouldn't/ clutter the
>> built-in dict's API with on_missing().
>
> +1. This is a much closer match to my own use of setdefault than  
> Guido's
> dict subtype. I'm +0 on the subtype, but I prefer the call-time  
> decision on
> whether to fall back to a default or not.

Cool!  As your reward:

SF patch #1438113

https://sourceforge.net/tracker/index.php? 
func=detail&aid=1438113&group_id=5470&atid=305470

-Barry

More information about the Python-Dev mailing list

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