[Python-ideas] Null coalescing operators

Sven R. Kunze srkunze at mail.de
Mon Sep 21 06:20:53 CEST 2015


On 21.09.2015 06:17, C Anthony Risinger wrote:
> Yes that is how I understand it as well. I'm suggesting it's hard to 
> see. I understand the concept as "None cancellation", because if the 
> left is None, the right is cancelled. This lead me here:
>
> * This is great, want to use all the time!
> * First-level language support, shouldn't I use? Does feels useful/natural
> * How can I make my APIs cancellation-friendly?
> * I can write None-centric APIs, that often collapse to None
> * Now maybe user code does stuff like 
> `patient.visits?.september?.records` to get all records in September 
> (if any, else None)
> * Since both `?` points would *prefer* None, if the result is None, I 
> now have to jump around looking for who done it
> * If I don't have debugger ATM, I'm breaking it up a lot for good 'ol 
> print(...), only way
> * I don't think I like this any more :(
>
> I especially don't like the idea of seeing it multiple times quickly, 
> and the potential impact to debugging. The truth is I want to like 
> this but I feel like it opens a can of worms (as seen by all the wild 
> operators this proposal "naturally" suggests).
>

It's interesting to see that everybody who ponders more than a minute 
about it, really fast comes to the same conclusion.

Best,
Sven


More information about the Python-ideas mailing list