Fwd: PEP 505: None-aware operators

Aargh, I hate Google Groups with a vengeance. If people *have* to post from there, can they please change reply-to so that replies don't get messed up. Or is that not possible, and yet another way that GG is just broken? Paul ---------- Forwarded message ---------- From: Paul Moore <p.f.moore@gmail.com> Date: 22 July 2018 at 12:05 Subject: Re: [Python-ideas] PEP 505: None-aware operators To: Grégory Lielens <gregory.lielens@gmail.com> Cc: python-ideas <python-ideas@googlegroups.com> On 22 July 2018 at 11:54, Grégory Lielens <gregory.lielens@gmail.com> wrote:
Except that the third possibility is not possible...if a is None, a[2] will throw an exception... For now at least ;-)
Doh. True, I should have said "If a is not None and a[2] is not None, use a[2]". But my point about unintended behaviour if a[2] is None stands. And the wider point that these operators are hard to reason correctly about is probably emphasised by my mistake. Paul
participants (1)
-
Paul Moore