[Python-ideas] Type Hinting Kick-off

Eugene Toder eltoder at gmail.com
Fri Dec 26 19:22:41 CET 2014


On Fri, Dec 26, 2014 at 12:59 PM, Eugene Toder <eltoder at gmail.com> wrote:
> Why is it hard? Isn't the actual type just:
>
> def union(self, *others: Iterable[Y]) -> Set[Union[X, Y]]
>
> where typing of vararg is similar to Java -- all elements must conform to the
> single type annotation.
To be even more precise, both X and Y should conform to a Hashable protocol,
rather than being unconstrained. So this is also a simple example of why
constraints on type variables are useful.


Eugene


More information about the Python-ideas mailing list