This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author remi.lapeyre
Recipients da-dada, eric.smith, remi.lapeyre
Date 2019-12-08.22:39:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CA+jiYFBcxe5yiSJWVYW7fA_GyHFBQzQwof7OSC=SQWrge7juCw@mail.gmail.com>
In-reply-to <1575841625.12.0.864811549742.issue38998@roundup.psfhosted.org>
Content
The documentation is correct, in Python argument are computed before the
call to a function, not when they are used. You can try other functions
than dict.setdefault() and see that the behaviour is always the same.

Le dim. 8 déc. 2019 à 22:47, da-dada <report@bugs.python.org> a écrit :

>
> da-dada <georg.klingenberg@travedsl.de> added the comment:
>
> I have no problem of making my programme run properly (asking first if in
> dict etc), but I just read the docu of dict.setdefault
>
> setdefault(key[, default])
> If key is in the dictionary, return its value. If not, insert key with a
> value of default and return default. default defaults to None.
>
> and it clearly reads if the key is.. return its value, with a full stop;
> so either the docu is wrong (but proposes exactly the needed shortcut) or
> python is as it is: come in & find out
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue38998>
> _______________________________________
>
History
Date User Action Args
2019-12-08 22:39:03remi.lapeyresetrecipients: + remi.lapeyre, eric.smith, da-dada
2019-12-08 22:39:03remi.lapeyrelinkissue38998 messages
2019-12-08 22:39:02remi.lapeyrecreate