[Python-ideas] PEP 505: None-aware operators
Steven D'Aprano
steve at pearwood.info
Thu Jul 19 19:32:57 EDT 2018
On Thu, Jul 19, 2018 at 11:39:50AM -0700, Brendan Barnwell wrote:
> On 2018-07-19 06:38, Steven D'Aprano wrote:
> >*Its just spelling*. If it is a useful and well-defined feature, we'll
> >get used to the spelling soon enough.
> >
> >That's not to say that spelling is not important *at all*, or that we
> >should never prefer words to symbols. But if the only objection we have
> >is "this is useful but I don't like the spelling so -1" then that's
> >usually a pretty weak argument against the feature.
>
> But we already have a spelling for the most common case. It is:
>
> x = a if a is not None else b
>
> That is the only use case of any of these operators that is actually
> common enough for me to care about --- but it's still not common enough
> to warrant the creation of a new operator, let alone multiple new operators.
That's a reasonable argument: "there's no need for this operator
because...", albeit it is a subjective argument. (There's no objective
rule about how common an operation should be before allowing it to be an
operator.)
What's not a reasonable argument is "I see that there could be a need
for this operator, but I don't like the spelling so -1 on the entire
proposal", which was my point. (One of my points.)
--
Steve
More information about the Python-ideas
mailing list