Overriding property types on instances from a library

Joseph L. Casale jcasale at activenetwerx.com
Sat Feb 20 09:36:11 EST 2021


I have some code that makes use of the typing module.
This code creates several instances of objects it creates
from a library that has some issues.

For example, I have multiple list comps that iterate properties
of those instance and the type checker fails with:

    Expected type 'collections.Iterable', got '() -> Any' instead

How can I override the type with a hint on a property of
those instances?

Thanks,
jlc


More information about the Python-list mailing list