<span style="font-size:13.1999998092651px">Before I forget, your typical forward-reference problem will most likely look like this:</span><br style="font-size:13.1999998092651px"><div style="font-size:13.1999998092651px"><br></div><div style="font-size:13.1999998092651px">class X(...):</div><div style="font-size:13.1999998092651px">    def method(self, other:: X):</div><div style="font-size:13.1999998092651px">        ...</div><br><div class="gmail_quote">On Mon Jan 19 2015 at 11:15:05 PM Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 19, 2015 at 12:30 PM, Devin Jeanpierre <span dir="ltr"><<a href="mailto:jeanpierreda@gmail.com" target="_blank">jeanpierreda@gmail.com</a>></span> wrote:<br></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Sun, Jan 18, 2015 at 4:01 PM, Greg <<a href="mailto:greg.ewing@canterbury.ac.nz" target="_blank">greg.ewing@canterbury.ac.nz</a>> wrote:</span></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
> Do you mean *static* types, or types in general?<br>
><br>
> If they're only for static type checking, this seems a waste of a<br>
> facility that evaluates things at run time. Moreover, evaluating<br>
> them at run time is actually counterproductive, since it makes<br>
> dealing with things like forward references unnecessarily awkward.<br>
> It also introduces useless runtime overhead. And they only address<br>
> part of the problem, since they only apply to functions and not<br>
> other things we might want to specify the type of.<br>
<br>
</span>Strong +1. The current proposal is a historical accident, it would not<br>
be designed this way if it was designed from scratch. That's not a<br>
nice thing to include in the core language. (Although it does happen<br>
often, since "practicality beats purity").<br></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote><div><br></div><div>It's stronger than that. I'd say that all of Python is a historical accident.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I like the :: idea.<span></span><br clear="all"></blockquote></div><br></div><div class="gmail_extra">Blechh. It smells of C++ and syntax hacks. PEP 3107 is over 8 years old (also a historical accident :-). Let's stick with the devil we know.</div></div></blockquote><div><br></div><div>You know, I feel pretty good when I get to write python helper scripts in Python 3 because I get to write</div><div><br></div><div>    def my_script(address, *, port:'p'=80):</div><div>        ...</div><div>    run(my_script)</div><div><br></div><div>rather than</div><div><br></div><div>    @kwoargs('port')</div><div>    @annotate(port='p')</div><div>    def my_script(address, port=80):</div><div>        ...</div><div><span style="font-size:13.1999998092651px">    run(my_script)</span><br></div><div><span style="font-size:13.1999998092651px"><br></span></div><div>With just one parameter to annotate, we go from 19 characters plus imports in Python 2.7, to just 4. In 4 characters, in just as much clarity as with 19, I made "-p 8080" synonymous with "--port 8080". Didn't have to think it through, didn't have to go back and add imports, just had to wish "it would be nice if I could use -p instead".</div><div><br></div><div>That's what I had in mind when writing this argument parser, when I added annotation support to it, when I made annotations the primary way of specifying anything with it. Annotations have been great, and this little project wouldn't have existed in another programming language.</div><div><br></div><div>Reserving annotations for typing info, as you suggested is your long-term goal, takes that away and takes eager users of my library on Python 3 halfway back to Python 2.</div><div><br></div><div>Not cool.</div><div><br></div><div>I understand, from this thread and previous threads about this PEP, that you intended from the get-go parameter annotations to be used for type hinting and co. This appeared in the annotations PEP as a mere suggestion in a bullet point list, and more importantly did not appear in the docs.</div><div><br></div><div>If the chain of historical accidents is to continue, maybe it shall include Python opting to spawn a separate kind of annotation better-suited for static analysis alongside the dynamic ones that can be used in all kinds of stuff that look ugly in other languages.</div><div><br></div><div>If the problem against :: really is "There's no time before 3.5", that's really just "Postpone it until 3.6" waiting to be said. That'll be more time to see if whatever is drafted up is useful to static analysis tools and statically-analysed code bases. It has already waited 24 years after all. As for C++'s infamous "> >" vs ">>", "::" isn't comparable because ": :" does not exist and isn't about to. (Right?)</div><div><br></div><div>The :: idea otherwise brings advantages to all as outlined before, so I'm a bit frustrated to see it dismissed on mere feeling.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">-- <br><div>--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div></div>
______________________________<u></u>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank">https://mail.python.org/<u></u>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank">http://python.org/psf/<u></u>codeofconduct/</a></blockquote></div>