
On Thu, Jul 26, 2018 at 12:56 PM, David Mertz <mertz@gnosis.cx> wrote:
On Wed, Jul 25, 2018 at 10:41 PM Chris Angelico <rosuav@gmail.com> wrote:
A bit problematic. But after (a) figuring out that your module is named "coalesce" even though I installed "coalescing" AND (b) going and separately installing wrapt, and finally (c) doing the import that you didn't mention, we still have this fundamental problem:
Yeah, yeah. I know it's alpha software I wrote two nights ago, and slightly patched 5 minutes before that post. You fixed those concerns; I'll happily take PRs on fixing them better.
PRs? Nope. I don't think it's possible to do this with correct semantics without language support.
spam.nil = None print(NullCoalesce(spam).nil.nil) None print(NullCoalesce(spam).nil.nil.nil) Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'NoneType' object has no attribute 'nil'
Why is this wrong? This is EXACTLY the same behavior as the `?.` operator would have in the last case. Do you not recognize the behavior you are advocating in PEP 505?
With PEP 505, I could write this:
spam = SimpleNamespace() spam.nil = None print(spam?.nil) None print(spam?.nil?.nil) None print(spam?.nil?.nil?.nil) None print(spam?.nil?.nil?.nil?.nil) None
Can you do that with your proxy? ChrisA