[Python-ideas] PEP 505: None-aware operators
p.f.moore at gmail.com
Sun Jul 22 03:32:03 EDT 2018
On 22 July 2018 at 02:54, Steven D'Aprano <steve at pearwood.info> wrote:
> I'll admit that the number and variety of new operators gives me some
> reason to pause, but for the simplest and most obvious case, the
> proposed ?? operator, I think that the fears about readability are
> grossly exaggerated.
Certainly *my* concerns about readability are around the other
proposed operators (?[ and ?. in particular).
> In my opinion, writing
> expression if expression is None else default
> is the *opposite* of Pythonic, it is verbose and the DRY violation is
> inelegant (as well as inefficient). I'd much rather use:
> expression ?? default
Agreed. But the PEP proposes three other operators, and it's not at
all clear to me that those are such clear wins.
More information about the Python-ideas