Message358037
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>
> _______________________________________
> |
|
Date |
User |
Action |
Args |
2019-12-08 22:39:03 | remi.lapeyre | set | recipients:
+ remi.lapeyre, eric.smith, da-dada |
2019-12-08 22:39:03 | remi.lapeyre | link | issue38998 messages |
2019-12-08 22:39:02 | remi.lapeyre | create | |
|