Category "python-typing"

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 'error' in result: raise

How do I type hint a method with the type of the enclosing class?

I have the following code in Python 3: class Position: def __init__(self, x: int, y: int): self.x = x self.y = y def __add__(self, oth

python - Difference of typing with AsyncGenerator or AsyncIterator?

I make creating a discord asynchronous library that is fully typed. I have a method that create objects from a aiohttp get requests such as the following exampl