[Python-ideas] PEP 505: None-aware operators
Giampaolo Rodola'
g.rodola at gmail.com
Tue Jul 24 05:05:24 EDT 2018
On Tue, Jul 24, 2018 at 2:22 AM MRAB <python at mrabarnett.plus.com> wrote:
> >> > It
> >> > does so by introducing a brand new operator ("?") which can be spelled
> >> > in two forms ("a?.b" and "a?[b]") by using two adjacent symbols not
> >> > interrupted by any space, which is an absolute first in the Python
> >> > syntax
> >>
> >> It isn't a first. Many existing operators use two adjacent symbols not
> >> interrupted by a space:
> >>
> >> e.g. == <= >= != ** // << >> += -= *= etc.
> >
> > You say 'a == b'. You can't say 'a ?. b' (not that it matters, it
> > would be less intuitive anyway). You can't because '.?' is the only
> > couple of contiguous symbols requiring "something" before and after
> > with no spaces in between, and that's a first in the language.
>
> You _can_ say 'a ?. b', just as you _can_ say 'a . b'.
You're right. It's so uncommon I forgot this style was valid. Anyway,
as I said 'a ?. b' would be even worse the same way 'a . b' is worse
than 'a.b'. The recommended and broadly used spelling would be 'a?.b'.
--
Giampaolo - http://grodola.blogspot.com
More information about the Python-ideas
mailing list