[Python-ideas] PEP 505: None-aware operators
Nicholas Chammas
nicholas.chammas at gmail.com
Wed Jul 25 18:44:12 EDT 2018
On Wed, Jul 25, 2018 at 6:36 PM David Mertz <mertz at gnosis.cx> wrote:
> The fact that a while bunch have people have commented on this subthread
> while not recognizing that the semantics of the '?.' and the if blocks are
> entirely different suggests the operators are but magnets.
>
> On Wed, Jul 25, 2018, 5:17 PM Nicholas Chammas <nicholas.chammas at gmail.com>
> wrote:
>
>> On Mon, Jul 23, 2018 at 6:05 PM Giampaolo Rodola' <g.rodola at gmail.com>
>> wrote:
>>
>>> This:
>>>
>>> v = a?.b
>>>
>>> ...*implicitly* checks if value is not None [and continues execution].
>>> This:
>>>
>>> v = a
>>> if a.b is not None:
>>> v = a.b
>>>
>>> ...*explicitly* checks if value is not None and continues execution.
>>>
>>
Sorry, lazy reading on my part. I skimmed the expanded form assuming it was
correct. I think it should instead read `if a is not None: ...`.
Is that what you're getting at?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180725/29f5ec34/attachment.html>
More information about the Python-ideas
mailing list