hit counter

Timeline

My development logbook

Why Do You Need Explicitly Have the 'Self' Argument Into a Python Method?

I like to quote Peters’ Zen of Python. “Explicit is better than implicit.”

I In Java and C++, this can be deduced, except when you have variable names that make it impossible to deduce. So you sometimes need it and sometimes don’t.

I Python elects to make things like this explicit rather than based on a rule.

I Additionally, since nothing is implied or assumed, parts of the implementation are exposed. self.__class__, self.__dict__ and other “internal” structures are available in an obvious way.

by S. Lott]