Skip to content

Tag: python-typing

Differentiate class and object in Python type hints

Django’s post_save signal sends a model class argument – sender – along with the actual instance being saved – instance. Is there a way to differentiate between the two in type hints? Example We have a model User and would like to create a post_save signal: As you can see, I have given both sender and i…