[Python-ideas] Null coalescing operators

Chris Angelico rosuav at gmail.com
Mon Sep 21 06:57:14 CEST 2015


On Mon, Sep 21, 2015 at 2:52 PM, Sven R. Kunze <srkunze at mail.de> wrote:
> I limit myself to materializing default arguments as in:
>
> def a(b=None):
>     b = b or {}
>     ...

As long as you never need to pass in a specific empty dictionary,
that's fine. That's the trouble with using 'or' - it's not checking
for None, it's checking for falsiness.

ChrisA


More information about the Python-ideas mailing list