Showing content from http://mail.python.org/pipermail/python-dev/attachments/20171120/70ccf4f1/attachment.html below:
<div dir="ltr">OK, this is fine. It won't affect mypy (which will continue to treat string literals the same as before) but it will require an update to typing.py -- hope you are working on that with Ivan.<br><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 20, 2017 at 9:58 AM, Lukasz Langa <span dir="ltr"><<a href="mailto:lukasz@langa.pl" target="_blank">lukasz@langa.pl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I agree with you. The special handling of outermost strings vs. strings embedded inside annotations bugged me a lot. Now you convinced me that this functionality should be moved to `get_type_hints()` and the __future__ import shouldn't try to special-case this one instance, while leaving others as is.<br>
<br>
I will be amending the PEP accordingly.<br>
<br>
- Å<br>
<div><div class="h5"><br>
> On Nov 19, 2017, at 10:56 AM, Mark Shannon <<a href="mailto:mark@hotpy.org">mark@hotpy.org</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> Overall I am strongly in favour of this PEP. It pretty much cures all the ongoing pain of using PEP 3017 annotations for type hints.<br>
><br>
> There is one thing I don't like however, and that is treating strings as if the quotes weren't there.<br>
> While this seems like a superficial simplification to make transition easier, it introduces inconsistency and will ultimately make both implementing and using type hints harder.<br>
><br>
> Having the treatment of strings depend on their depth in the AST seems confusing and unnecessary:<br>
> "List[int]" becomes 'List[int]' # quotes removed<br>
> but<br>
> List["int"] becomes 'List["int"]' # quoted retained<br>
><br>
> Also,<br>
><br>
> T = "My unparseable annotation"<br>
> def f()->T: pass<br>
><br>
> would remain legal, but<br>
><br>
> def f()->"My unparseable annotation"<br>
><br>
> would become illegal.<br>
><br>
> The change in behaviour between the above two code snippets is already confusing enough without making one of them a SyntaxError.<br>
><br>
> Using annotations for purposes other than type hinting is legal and has been for quite a while.<br>
> Also, PEP 484 type-hints are not the only type system in the Python ecosystem. Cython has a long history of using static type hints.<br>
><br>
> For tools other than MyPy, the inconsistent quoting is onerous and will require double-quoting to prevent a parse error.<br>
> For example<br>
><br>
> def foo()->"unsigned int": ...<br>
><br>
> will become illegal and require the cumbersome<br>
><br>
> def foo()->'"unsigned int"': ...<br>
><br>
> Cheers,<br>
> Mark.<br>
><br>
> ______________________________<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>
</div></div>> Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/lukasz%40langa.pl" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/options/python-dev/<wbr>lukasz%40langa.pl</a><br>
<br>
<br>______________________________<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>
<br></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></div></div>
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4