[Python-ideas] PEP 505: None-aware operators

Antoine Pitrou solipsis at pitrou.net
Sun Jul 22 16:49:32 EDT 2018


On Sun, 22 Jul 2018 22:43:15 +0200
"Giampaolo Rodola'" <g.rodola at gmail.com>
wrote:

> On Sun, Jul 22, 2018 at 10:01 PM Chris Angelico <rosuav at gmail.com> wrote:
> >
> > On Mon, Jul 23, 2018 at 1:09 AM, Giampaolo Rodola' <g.rodola at gmail.com> wrote:  
> > > On Sun, Jul 22, 2018 at 3:38 PM Chris Angelico <rosuav at gmail.com> wrote:
> > > I find it less explicit mainly because it does 3 things at once: check
> > > if attribute is None, use it if it's not None and continue the
> > > evaluation from left to right. I find that logic to be more explicit
> > > when living on different lines or is clearly delimited by keywords and
> > > spaces. ? has no spaces, it's literally "variable names interrupted by
> > > question marks" and evaluation can stop at any time while scanning the
> > > line from left to right. Multiple "?" can live on the same line so
> > > that's incentive to write one-liners, really, and to me one-liners are
> > > always less explicit than the same logic split on multiple lines.  
> >
> > Ah, I see what you mean. Well, think about what actually happens when
> > you write "lst.sort()". In terms of "hidden behaviour", there is far
> > FAR more of it in existing syntax than in the new proposals.  
> 
> I am not sure I'm following you (what does lst.sort() have to do with "?"?).
> 
> > Which is back to what Steven said: people demand such a high
> > bar for new syntax that few existing pieces of syntax would pass it.  
> 
> Probably. That's what happens when a language is mature. Personally I
> don't think that's a bad thing.

Agreed with Giampaolo.  The opportunities for syntax additions should
become rarer and rarer.

Regards

Antoine.




More information about the Python-ideas mailing list