On Wed, Jul 25, 2018 at 6:36 PM David Mertz <[email protected]> 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 <[email protected]> > wrote: > >> On Mon, Jul 23, 2018 at 6:05 PM Giampaolo Rodola' <[email protected]> >> 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?
_______________________________________________ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
