type hinting backward compatibility with python 3.0 to 3.4
Gregory Ewing
greg.ewing at canterbury.ac.nz
Sun May 21 05:15:15 EDT 2017
Chris Angelico wrote:
> How do you declare that a parameter must be an instance of some class?
> Classes are themselves created at run time. Or would your typing
> system require that all types be created in some declarable way?
Types that you want statically checked have to be described
in a declarative way, because the description is going to be
processed by a tool that is not executing the program.
You wouldn't be able to put a type that can't be described
declaratively into a type annotation, but there would be no
reason to do so in the first place.
--
Greg
More information about the Python-list
mailing list