Why dict.setdefault() has value as optional?

Marco Sulla Marco.Sulla.Python at gmail.com
Wed Feb 2 07:54:10 EST 2022


Just out of curiosity: why dict.setdefault() has the default parameter
that.... well, has a default value (None)? I used setdefault in the past,
but I always specified a value. What's the use case of setting None by
default?


More information about the Python-list mailing list