Hi,

 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
missing.

Regards,
Sidharth


On Wed, Oct 21, 2009 at 8:29 AM, Roshan Mathews <rmath...@gmail.com> wrote:
> On Wed, Oct 21, 2009 at 8:06 AM, srid <sridhar.ra...@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@python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>



-- 
I am but a man.
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to