Top "Type-hinting" questions

Type hinting binds function arguments to specific objects or strongly types them.

How to use type hints in python 3.6?

I noticed python 3.5 and python 3.6 added a lot of features about static type checking, so I tried with the following …

python python-3.x type-hinting python-3.6 mypy
What is the return type hint of a generator function?

I'm trying to write a :rtype: type hint for a generator function. What is the type it returns? For example, …

python python-2.7 generator yield type-hinting
Why is type hinting necessary in PHP?

I am having trouble wrapping my head around the importance of Type hinting in PHP. Apparently 'type hinting' in PHP …

php oop type-hinting
Python type hinting with exceptions

I have a function that looks like this: def check_for_errors(result): if 'success' in result: return True if …

python python-3.x exception type-hinting
Is it possible to specify more than one type hint for a parameter?

Is there a way to add more than one type hinting to a method? For example, foo(param) must receive …

php type-hinting
Python type hinting: how to tell X is a subclass for Foo?

How should I write a type hint for class types in Python? Consider this code: class A(object): pass class …

python python-3.x django-models type-hinting
Create .pyi files automatically?

How can I automatically create the boilerplate code of pyi files? I want to create a pyi file for type …

python pycharm type-hinting
TypeHinting tuples in Python

When I want to typehint a tuple in Python like: def func(var: tuple[int, int]): # do something func((1, 2)) # would …

python type-hinting
Type hinting in Eclipse with PyDev

I'm studying Python, after a lot of PHP experience, and it would be handy to have type-hinting in Python. Looks …

python pydev type-hinting
mypy, type hint: Union[float, int] -> is there a Number type?

mypy is really handy and catches a lot of bugs, but when I write "scientific" applications, I often end up …

python type-hinting mypy union-types