[Python-Dev] Not Deprecating Arbitrary Function Annotations (original) (raw)

Sven R. Kunze srkunze at mail.de
Mon Oct 5 17:06:21 EDT 2015


Not really being affected by the "python annotation movement", I supply some non-constructive comment:

I would not prefer any of these outcomes but would always allow all possible meanings that people wish to encode in the annotations.

My $0.02 and I am out.

On 05.10.2015 22:46, Steve Wedig wrote:

Brett and Alexander,

I am concerned about deprecation of arbitrary function annotations because Pep 484 suggests that two paths are under consideration. Here is the relevant section: " 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 with Python 3.5. The current PEP will have provisional status (see PEP 411 ) until Python 3.6 is released. The fastest conceivable scheme would introduce silent deprecation of non-type-hint annotations in 3.6, full deprecation in 3.7, and declare type hints as the only allowed use of annotations in Python 3.8. This should give authors of packages that use annotations plenty of time to devise another approach, even if type hints become an overnight success. 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. For this purpose the current proposal defines a decorator @notypecheck which disables the default interpretation of annotations as type hints in a given class or function. It also defines a meta-decorator @notypecheckdecorator which can be used to decorate a decorator (!), causing annotations in any function or class decorated with the latter to be ignored by the type checker. " I am advocating against paragraph 1 (a deprecation path) and for the course of action stated in paragraph 2 :)



More information about the Python-Dev mailing list