> On Sep 11, 2017, at 1:16 PM, Ryan Gonzalez <rym...@gmail.com> wrote:
> 
> One thing I want to point out: there are a lot of really useful Python
> libraries that have come to rely on annotations being objects, ranging
> from plac to fbuild to many others.

Shout out to fbuild which is a project that was built on Python 3 since early 
2008, running on RCs of Python 3.0! Mind=blown.

We are aware of fbuild, plac, and dryparse, Larry Hastings' similar project. 
But I definitely wouldn't say there are "a lot of" libraries like that, in fact 
I only know of a handful more, most of them early stage "runtime type checkers" 
with minimal adoption.

When PEP 484 was put for review, we were testing the waters here, and added 
wording like:

"In order for maximal compatibility with offline type checking it may 
eventually be a good idea to change interfaces that rely on annotations to 
switch to a different mechanism, for example a decorator."

and

"We do hope that type hints will eventually become the sole use for 
annotations, but this will require additional discussion and a deprecation 
period after the initial roll-out of the typing module. (...) Another possible 
outcome would be that type hints will eventually become the default meaning for 
annotations, but that there will always remain an option to disable them."

Turns out, only authors of a few libraries spoke up AFAICT and most were happy 
with @no_type_hints. I remember mostly Stefan Behnel's concerns about Cython's 
annotations, and those never really took off. The bigger uproar at the time was 
against Python becoming a "statically typed language".

Summing up, PEP 563 is proposing a backwards incompatible change but it doesn't 
look like it's going to affect "a lot of" libraries. More importantly, it does 
provide a way for those libraries to keep working.


> I could understand something that
> delays the evaluation of annotations until they are accessed, but this
> seems really extreme.

This PEP is proposing delaying evaluation until annotations are accessed but 
gives user code the power to decide whether the string form is enough, or maybe 
an AST would be enough, or actual evaluation with get_type_hints() or eval() is 
necessary.

- Ł

Attachment: signature.asc
Description: Message signed with OpenPGP

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to