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

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

Typehint Importing Module Dynamically Using Importlib

Give something as follows: import importlib module_path = 'mod' mod = importlib.import_mod… Read more Typehint Importing Module Dynamically Using Importlib

Type-hinting Parameters With A Sentinel Value As The Default

I currently use this strategy when I cannot assign default arguments in a function's signature … Read more Type-hinting Parameters With A Sentinel Value As The Default

How Can Request.param Be Annotated In Indirect Parametrization?

In the Indirect parametrization example I want to type hint request.param indicating a specific typ… Read more How Can Request.param Be Annotated In Indirect Parametrization?

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?

Python Metaclass - Make Class Property Accessible Via Class And Class Instance

Using python 3.7, I have created a class property in a metaclass. I would like to be able to access… Read more Python Metaclass - Make Class Property Accessible Via Class And Class Instance

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?

Type Hint For Return Value In Subclass

I am writing a CustomEnum class in which I want to add some helper methods, that would then be avai… Read more Type Hint For Return Value In Subclass