Asqiir
Asqiir

Reputation: 627

(Django) save(*args, **kwargs) vs. save(**kwargs)

When I searched for overriding the save method I found to different things:

def save(self, **kwargs):
  pass

and:

def save(self, *args, **kwargs):
  pass

What's better?

Upvotes: 0

Views: 283

Answers (1)

dentemm
dentemm

Reputation: 6379

save(self, *args, **kwargs) is the recommended way to go since it is the signature you can find in the django source code

Edit: I am assuming you are talking about the save() method in case of django models

Upvotes: 1

Related Questions