I am reading django's source code, and i can not understand what this code is doing.
def check_password(self, raw_password):
"""
Return a boolean of whether the raw_password was correct. Handles
hashing formats behind the scenes.
"""
def setter(raw_password):
self.set_password(raw_password)
# Password hash upgrades shouldn't be considered password changes.
self._password = None
self.save(update_fields=["password"])
return check_password(raw_password, self.password, setter)
why the function return itself, why there is no infinite loop? this a code snippet from django/contrib/auth/base_user.py