Add an optional type file for Type Annotation

I'm inspired by TypeScript. TypeScript allows people to add **.d.ts* *to annotate ECMAScript's type. So this can expand the TypeScript's scenes to be used。 So I think can we add an optional mechanism to allow people add the extra file to annotate the existing code. Type Annotation can be used after Python 3.5. but many lib/framework has to be compatible for the Python 3.0-3.4, they can't use annotation. If we have this mechanism, the lib/framework can continue to focus on the function, and the third group can add the extra type annotation for lib/framework I think it should be OK

On Tue, Jun 26, 2018 at 08:59:22PM -0700, 李者璈 wrote:
I'm sorry, I do not understand what you mean by this. Unless you mean stub files? Stub files are already supported. https://www.python.org/dev/peps/pep-0484/
Function annotations work in Python 3.0 onwards. Using comments for annotations work for any version of Python: x = [] # type: List[Employee] This is also discussed in the PEP. -- Steve

On Tue, Jun 26, 2018 at 08:59:22PM -0700, 李者璈 wrote:
I'm sorry, I do not understand what you mean by this. Unless you mean stub files? Stub files are already supported. https://www.python.org/dev/peps/pep-0484/
Function annotations work in Python 3.0 onwards. Using comments for annotations work for any version of Python: x = [] # type: List[Employee] This is also discussed in the PEP. -- Steve
participants (2)
-
Steven D'Aprano
-
李者璈