Quantcast
Viewing all articles
Browse latest Browse all 77

Answer by dan-klasson for What is the purpose of the `self` parameter? Why is it needed?

It’s there to follow the Python zen “explicit is better than implicit”. It’s indeed a reference to your class object. In Java and PHP, for example, it's called this.

If user_type_name is a field on your model you access it by self.user_type_name.


Viewing all articles
Browse latest Browse all 77

Trending Articles