Skip to content Skip to sidebar Skip to footer
Showing posts with the label Type Hinting

In Python Type-hinting, How Can I Make An Argument Accept Any Subclass Of A Base Class?

I have a function that looks a bit like this. I want the function to accept any subclass of io.IOBa… Read more In Python Type-hinting, How Can I Make An Argument Accept Any Subclass Of A Base Class?

Python's Pep 484 Type Annotation For Generator Expression

What is the correct type annotation for a function that returns a generator expression? e.g.: def … Read more Python's Pep 484 Type Annotation For Generator Expression

Type Hinting For Objects Of Type That's Being Defined

I get the error: NameError: name 'OrgUnit' is not defined class OrgUnit(object): def … Read more Type Hinting For Objects Of Type That's Being Defined

How To Use Reveal_type In Mypy

I have read that I can reveal the type of variables by using a function called reveal_type, but I c… Read more How To Use Reveal_type In Mypy

What Is The Difference Between Typevar And Newtype?

TypeVar and NewType seem related but I'm not sure when I'm supposed to use each or what the… Read more What Is The Difference Between Typevar And Newtype?

How To Use Typeshed With Mypy?

I cloned typeshed but I can't figure out how to tell mypy to use the type hints it contains, I … Read more How To Use Typeshed With Mypy?

Typing Hints Pycharm For A Class Used Within Itself

How do I properly type a class within itself? In PyCharm I am currently getting this error: This i… Read more Typing Hints Pycharm For A Class Used Within Itself

In Python 3.5, How Can I Specify A Function As A Type Hint?

What is the appropriate type hint to specify that a variable should be a function (the equivalent o… Read more In Python 3.5, How Can I Specify A Function As A Type Hint?