[Tutor] Why is the name "self" optional instead of mandatory?

Ben Finney ben+python at benfinney.id.au
Thu Jan 21 01:57:36 EST 2016


boB Stepp <robertvstepp at gmail.com> writes:

> So I really only have one question: Why not make Python's
> *traditional* name, "self", mandatory? Why give the programmer this
> kind of choice?

For the same reason that four-space indentation is not mandatory, yet
anyone who chooses a different indentation size needs to produce good
reasons why.

In both cases: Because nothing is broken, nor made especially ambiguous,
by choosing differently. And because the Python community of programmers
can be relied upon to enforce the convention, as with most other
conventions.

-- 
 \      “When I was a little kid we had a sand box. It was a quicksand |
  `\           box. I was an only child... eventually.” —Steven Wright |
_o__)                                                                  |
Ben Finney



More information about the Tutor mailing list