
July 22, 2018
7:32 a.m.
On 22 July 2018 at 02:54, Steven D'Aprano <steve@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. Paul