6 ms·
It’s not a good idea in Python. There are legitimate reasons to pass falsy objects as function arguments.
by jacobolus 16y ago
It’s not a good idea in Python. There are legitimate reasons to pass falsy objects as function arguments.
- robinhouston 16y agoFunnily enough, Perl (since version 5.10) actually has a solution to this. The expression $foo // "default" evaluates to "default" if $foo is undefined, and to $foo otherwise (even if it is defined but false).