Why dict.setdefault() has value as optional?

Marco Sulla Marco.Sulla.Python at gmail.com
Wed Feb 2 10:21:27 EST 2022


On Wed, 2 Feb 2022 at 14:34, Lars Liedtke <liedtke at punkt.de> wrote:
>
> This is a quite philosophical queston if you look at it in general:
> "What value do you give a variable, that is not set?"

Maybe I expressed my question badly. My existential doubt is why
setdefault has an optional parameter for the value and not a required
parameter. I'm not asking why the default is None.


More information about the Python-list mailing list