<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 28 October 2016 at 14:13, Barry Warsaw <span dir="ltr"><<a href="mailto:barry@python.org" target="_blank">barry@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Oct 27, 2016, at 07:37 PM, Nick Badger wrote:<br>
<br>
>The problem with doing that is that it's ambiguous. There's no way of<br>
>telling which attribute is allowed to coalesce.<br>
<br>
</span>You could of course support exactly the same syntax being proposed as a<br>
language change, e.g.<br>
<br>
    from operator import attrgetter<br>
    r = attrgetter('b?.x?.z')<br>
<br>
and then you wouldn't even need the `coalesce` argument.<br></blockquote><div><br></div><div>The main drawback of this type of approach is that code checking tools will hardly ever support checking expressions inside the string like that.  Also, you don't get proper syntax highlighting, code completion, etc.</div><div><br></div><div>You can do anything you want by writing another programming language that is passed as string to a function, but that is not the same thing as having a proper syntax, is it?  Just like type annotations with mypy: sure, you can add type annotations in comments, but it's not the same...</div><div><br></div></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Gustavo J. A. M. Carneiro<div>Gambit Research<br>"The universe is always one step beyond logic." -- Frank Herbert</div></div></div>
</div></div>