[Python-ideas] PEP 505 (None coalescing operators) thoughts

Chris Angelico rosuav at gmail.com
Wed Sep 30 18:47:44 CEST 2015


On Thu, Oct 1, 2015 at 2:41 AM, Jeff Hardy <jdhardy at gmail.com> wrote:
> 'def' is currently short for 'define', which would be too confusing.
> Spelling out 'default' isn't so bad, though:
>
>     self.x = x default []
>
> And if it's going to be that long anyway, we might as well just put a
> `default` function in the builtins:
>
>     self.x = default(x, [])

I'd prefer it to have language support rather than a builtin, so it
can shortcircuit. It won't often be important, but it would be nice to
be able to put a function call in there or something.

ChrisA


More information about the Python-ideas mailing list