Op wo 1 aug. 2018 10:50 schreef Chris Angelico <ros...@gmail.com>: > On Wed, Aug 1, 2018 at 6:45 PM, Jonathan Fine <jfine2...@gmail.com> wrote: > > Hi Chris > > > > Thank you for your reply. I think we're making good progress. > > > > You wrote > > > >>> 10) a ?. b ?. c > >>> 11) (a ?. b) ?. c > >> > >> I would parse those differently, but you may be right that they'll > >> always have the same final result. > > > > I'd like to get some certainty on this. I'm not aware of any value of > > 'a' for which #10 and #11 give different values. Can you (or anyone > > else) think of any such value? > > > >> Technically they should result in different code, though. > > > > Maybe. We need to think. Should can be a difficult word. Elsewhere you > > have, as I recall, pointed out that > > if None: > > do_something() > > generates no code. > > > > Perhaps the compiler should collapse #11 to #10, if they are > > equivalent. But this is a side issue. > > > > So, are there any values of 'a' for which #10 and #11 don't give the > > same result? > > I'm not prepared to put my neck out and say "They are absolutely > identical" and have people jump on me with some technicality.
Let me stand up and claim that if a chain consists *only* of None-coalescing operations, then breaking up the chain by adding parentheses does not matter, ever. So a?.b?.c is equivalent to (a?.b)?.c What is > your point here? > It is useful to establish rules under which a chain can be factored. Stephan > ChrisA > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/