[Python-ideas] PEP 505: None-aware operators: operators ?= and ?? and OR
Steven D'Aprano
steve at pearwood.info
Fri Aug 3 21:18:10 EDT 2018
On Fri, Aug 03, 2018 at 06:30:25AM -0700, Eric Fahlgren wrote:
> After looking at the code a bit more, I agree, we've uncovered a bug in the
> stdlib and the null coalescing version actually fixes it.
[...]
> But! We are not here to talk about bugs in the email package, this
> discussion is about PEP 505, which means to me that the example is a bug in
> the PEP.
On the contrary! It strongly suggests to me that None-aware operators,
or at least this one, makes it *easier* to write correct code than
incorrect code.
If your analysis that the email package is buggy is correct, this is a
strong example in favour of the none-aware operator.
> In my view, the before and after examples should have identical
> results, unless there is some very clear and thorough discussion
> accompanying the example as to why they are different and more importantly,
> why the "after" version is better or worse. In this light, the example
> certainly needs a lot of work.
It needs some work. Something like "Here's an example in the standard
library. On converting it to none-aware version, we realised the std lib
version is buggy, because ...". A couple of sentences.
--
Steve
More information about the Python-ideas
mailing list