
Sept. 30, 2015
6:49 p.m.
On 09/30/2015 12:41 PM, Jeff Hardy 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, [])
You lose the short circuiting.
I actually really like 'otherwise', but it's certainly not brief:
self.x = x if x is not None else [] self.x = x otherwise []
I'm -1 on needing syntax for this, but if we're going to do it, this is my favorite version I've seen so far. The usual caveats about adding a keyword apply. Eric.