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


bartc wrote:
> In fact the declaration of A might be in a different module from its use 
> in a type hint, which means that, in the CPython byte-code compiler 
> anyway, it is not visible at compile-time, when type hints could best be 
> put to good effect.

The static type checker would have to understand enough about
imports to deal with that.

> Furthermore, both A, and the type-hinting code, might be conditional. So 
> that on Tuesdays, A is a class, the rest of the week it's the name of a 
> module.

But that situation is hardly *static*, so you can't blame a
static type checker for not coping with it.

-- 
Greg