[BangPypers] An interesting beginner post at Stackoverflow

Sidharth Kuruvila sidharth.kuruvila at gmail.com
Wed Oct 21 08:35:14 CEST 2009


 d = {"a":"Hello"}

 print d.setdefault("a", "blah")

 Even though the string blah is not being used an object has to be
created to represent it. Even worse, you could put some complex
expression in there expecting it to evaluate only if the key is


On Wed, Oct 21, 2009 at 8:29 AM, Roshan Mathews <rmathews at gmail.com> wrote:
> On Wed, Oct 21, 2009 at 8:06 AM, srid <sridhar.ratna at gmail.com> wrote:
>> http://stackoverflow.com/questions/1597764/is-there-a-better-pythonic-way-to-do-this
> Nice.  Martelli says:
>    (avoid setdefault, that was never a good design and doesn't have
>     good performance either, as well as being pretty murky)
> Any idea why?
>> I am now researching on a way to gather top posts (w/ python tag) on
>> Stackoverflow to create something similar to weeklyreddit.appspot.com
> Weekly Reddit is such a cool idea, except I end up checking proggit
> frequently anyways.  Then I guilt out when I get the rss posts on
> Sunday.  :-S
> Roshan Mathews
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers

I am but a man.

More information about the BangPypers mailing list