This is a quite philosophical queston if you look at it in general: "What value do you give a variable, that is not set?"
You are right, at first it seems strange to have a default of None. But how do you want to signal that no default is set yet? Especially if you think of a dict that can have multiple keys with each different values of different types?
Have fun in the rabbithole ;-) Cheers Lars Am 02.02.22 um 13:54 schrieb Marco Sulla:
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?
-- punkt.de GmbH Lars Liedtke .infrastructure Kaiserallee 13a 76133 Karlsruhe Tel. +49 721 9109 500 https://infrastructure.punkt.de i...@punkt.de AG Mannheim 108285 Geschäftsführer: Jürgen Egeling, Daniel Lienert, Fabian Stein -- https://mail.python.org/mailman/listinfo/python-list