osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

type hinting backward compatibility with python 3.0 to 3.4


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