4 ms·
Having the default value be None isn't great for documentation, and it isn't great for static typing, because now your argument has to be of type Union[Foo, Non
by mrtranscendence 5y ago
Having the default value be None isn't great for documentation, and it isn't great for static typing, because now your argument has to be of type Union[Foo, None]. I've written functions where there are reasonably long chains of stuff like
if foo is None:
foo = []
and it'd be nice to be done with that.
- monkeybutton 5y agoI see what you're saying about typing. As for the reasonably long chains of default initialization code. Well now its in the definition. You could have functions with more code defining the parameters than in body.