[Python-ideas] PEP 505 (None coalescing operators) thoughts
Jeff Hardy
jdhardy at gmail.com
Wed Sep 30 18:41:53 CEST 2015
On Tue, Sep 29, 2015 at 5:24 PM, Alexander Belopolsky <
alexander.belopolsky at gmail.com> wrote:
>
> On Tue, Sep 29, 2015 at 7:57 PM, Andrew Barnert via Python-ideas <
> python-ideas at python.org> wrote:
>
>> If this is going to be a keyword rather than a symbol, it really has to
>> read like English, or at least like abbreviated English,
>
>
> I am -1 on this whole idea, but the keyword that comes to mind is "def":
>
> x def []
>
> may be read as x DEFaulting to [].
>
'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 actually really like 'otherwise', but it's certainly not brief:
self.x = x if x is not None else []
self.x = x otherwise []
That said, it's not used *that* often either, so maybe it's acceptable.
- Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150930/ca8ce0f4/attachment-0001.html>
More information about the Python-ideas
mailing list