<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr">Op wo 1 aug. 2018 11:10 schreef Jonathan Fine <<a href="mailto:jfine2358@gmail.com">jfine2358@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
You're right to be cautious. My understanding of PEP 505 is that<br>
#13. a ?. b ?. __str__<br>
#14. (a ?. b) ?. __str__<br>
are not equivalent. The first is None, and the other is None.__str__.<br>
That looks like a gotcha.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">No.</div><div dir="auto">None.?__str__</div><div dir="auto">produces None, even though None has a __str__ attribute.</div><div dir="auto"><br></div><div dir="auto">I am pretty sure </div><div dir="auto">a?.b?.c == (a?.b)?.c</div><div dir="auto"><br></div><div dir="auto">and more generically</div><div dir="auto"><br></div><div dir="auto">chain_A ?. chain_B == (chain_A) ?. chain_B</div><div dir="auto"><br></div><div dir="auto">Stephan</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
(By the way, it was not my intention to catch you out. I'm simply<br>
looking for clarity. I wasn't aware of the gotcha until I started<br>
answering myself the question I had asked you.)<br>
<br>
However, the None object is somewhat special, in that all it's methods<br>
and double-under (dunder) methods. And one of them is __bool__. And<br>
we can't add or change the attributes of None.<br>
<br>
Chris, you don't have to reply to this. But I would be pleased if an<br>
expert could either tell me that my neck is safe, or produce a value<br>
of 'a' that cuts it off (so to speak).<br>
<br>
-- <br>
Jonathan<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank" rel="noreferrer">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div></div></div>