[Python-ideas] PEP 505: None-aware operators
Steven D'Aprano
steve at pearwood.info
Thu Jul 19 09:38:21 EDT 2018
On Wed, Jul 18, 2018 at 08:05:56PM -0400, David Mertz wrote:
> '??' and '?.' and ?[]' are really just marching
> into APL and Perl territory. Yes, I know such operators exist in other
> languages, but it feels very unpythonic.
If these features exist in "other languages", and *don't* exist in APL
or Perl, how are they marching into APL and Perl territory?
Perl territory, like this perhaps?
print "hello world\n";
@days = ("Monday", "Tuesday", "Wednesday");
print $days[0]
Yes, I can see why we use "Perl syntax" as an insult *wink*
Okay, okay, my examples are a bit unfair. I deliberately chose examples
where the syntax is almost identical to Python's. Aside from the array
and scalar sigils @ and $ the above could be Python.
Tens of thousands of non-English speakers have had to learn the meaning
of what might as well be meaningless, random sets of symbols (to them)
like "class", "import", "while" and "True". If they can do so, perhaps
we English-speakers should stop complaining about how hard it is to
memorise the meaning of a couple of symbols like ??. Surely its no more
difficult than learning the various meanings of ** and [] which we've
already done.
*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.
--
Steve
More information about the Python-ideas
mailing list