<dict>.setdefault()
Tino Lange
tl_news at nexgo.de
Thu Jul 31 13:00:46 EDT 2003
On Thu, 31 Jul 2003 16:54:46 +0000 (UTC), Alexandre Fayolle
<alf at fayauffre.org> wrote:
>> I just realized that <dict>.setdefault *always* executes the second
>> argument - even if it's not necessary, because the requested item in
>> the first argument exists.
> method and function arguments are always evaluated before the
>method is called.
Yep. You're right. Of course it's like that.
Anyway - that's not what I expected in the first thought.
It shows that less code is not always the best code...
Thanks!
Tino
More information about the Python-list
mailing list