<div dir="ltr">IMO the inability of referencing class-level definitions from annotations on methods pretty much kills this idea.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 2, 2017 at 11:27 PM, Nick Coghlan <span dir="ltr"><<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 3 November 2017 at 04:39, Jukka Lehtosalo <<a href="mailto:jlehtosalo@gmail.com">jlehtosalo@gmail.com</a>> wrote:<br>
>> > * forward references: when a type hint contains names that have not been<br>
>> >   defined yet, that definition needs to be expressed as a string<br>
>> >   literal;<br>
>><br>
>> After all the discussion, I still don't see why this is an issue.<br>
>> Strings makes perfectly fine forward references. What is the problem<br>
>> that needs solving? Is this about people not wanting to type the leading<br>
>> and trailing ' around forward references?<br>
><br>
><br>
> Let's make a thought experiment. What if every forward reference would<br>
> require special quoting? Would Python programmers be happy with this? Say,<br>
> let's use ! as a suffix to mark a forward reference. They make perfectly<br>
> fine forward references. They are visually pretty unobtrusive (I'm not<br>
> suggesting $ or other ugly perlisms):<br>
><br>
> def main():<br>
>     args = parse_args!()  # A forward reference<br>
>     do_stuff!(args)  # Explicit is better than implicit<br>
><br>
> def parse_args():<br>
>     ...<br>
><br>
> def do_stuff(args):<br>
>     ...<br>
><br>
> Of course, I'm not seriously proposing this, but this highlights the fact<br>
> that in normal code forward references "just work" (at least usually), and<br>
> if we'd require a special quoting mechanism to use them anywhere, Python<br>
> would look uglier and more inconsistent. Nobody would be happy with this<br>
> change, even though you'd only have to type a single ! character extra --<br>
> that's not a lot work, right?<br>
><br>
> I think that the analogy is reasonable.<br>
<br>
</div></div>I think it also makes a pretty decent argument that pushing function<br>
annotations into implicit lambda expressions will be easier to explain<br>
to people than converting them into strings, and then having to<br>
explain an entirely new complex set of name resolution rules.<br>
<br>
Cheers,<br>
Nick.<br>
<span class="im HOEnZb"><br>
--<br>
Nick Coghlan   |   <a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>   |   Brisbane, Australia<br>
</span><div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/guido%40python.org" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/options/python-dev/<wbr>guido%40python.org</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div>