Skip to content Skip to sidebar Skip to footer
Showing posts with the label Python Typing

Why Is Mypy Complaining About List Comprehension When It Can't Be Annotated?

Why does Mypy complain that it requires a type annotation for a list comprehension variable, when i… Read more Why Is Mypy Complaining About List Comprehension When It Can't Be Annotated?

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

How To Hint At Number *types* (i.e. Subclasses Of Number) - Not Numbers Themselves?

Assuming I want to write a function that accepts any type of number in Python, I can annotate it as… Read more How To Hint At Number *types* (i.e. Subclasses Of Number) - Not Numbers Themselves?

PEP 484: Exclusive Type For Type Hint

Could I specify exclusive type? Something like this: def foo(bar: Not[str]) -> None: assert … Read more PEP 484: Exclusive Type For Type Hint