[Tutor] Why is the name "self" optional instead of mandatory?
Cameron Simpson
cs at zip.com.au
Thu Jan 21 00:40:41 EST 2016
On 20Jan2016 21:42, boB Stepp <robertvstepp at gmail.com> wrote:
>I'm whizzing along in "Python Crash Course" and am in the chapter on
>classes. Just to satisfy my suspicion that "self" is just a
>placeholder for creating an object instance,
No, it is a placeholder for a _preexiting_ object instance.
[...]
>So I really only have one question: Why not make Python's
>*traditional* name, "self", mandatory? Why give the programmer this
>kind of choice? [OK, that was two questions.]
Why make it mandatory? What benefit would it bring? Remember, one can write
nonsense or impossible to read gibberish in any language; most people don't try
to. So to repeat my question: why make it mandatory?
Cheers,
Cameron Simpson <cs at zip.com.au>
More information about the Tutor
mailing list