
Marc Mueller writes:
True, but from my experience 'None' is just by far the most common default. Why not improve how we handle it?
The question is whether this is an improvement in the long run. When some falsies are expected, in-range values, "if arg is None: ..." or "x = default if arg is None else arg" is sufficiently precise and concise. I don't see "arg ?? default" as an improvement worthy of syntax. One the minus side, as David Mertz testifies, there is a maze of missing value use cases, all alike (or is that a missing maze of values, all alike?) These operators would further encourage conflating them all into None. At least in theory, that's not an improvement in handling None, that's a loss of precision in handling an important subset of Nones. I just don't see much value in ??. I don't have an opinion on the ?. and ?[] versions. I can see that they could make chained operations much more concise than nested if ... else expressions, and at least somewhat more precise (at least if you want to avoid deep nesting of try ... except KeyError statements, which I suppose most everybody would like to avoid). Steve