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

DiliupG diliupg at gmail.com
Thu Jan 21 00:58:43 EST 2016


The answer to this will be an interesting read... :)
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
This
email has been sent from a virus-free computer protected by Avast.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Thu, Jan 21, 2016 at 11:10 AM, Cameron Simpson <cs at zip.com.au> wrote:

> 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>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>



-- 
Diliup Gabadamudalige

http://www.diliupg.com
http://soft.diliupg.com/

**********************************************************************************************
This e-mail is confidential. It may also be legally privileged. If you are
not the intended recipient or have received it in error, please delete it
and all copies from your system and notify the sender immediately by return
e-mail. Any unauthorized reading, reproducing, printing or further
dissemination of this e-mail or its contents is strictly prohibited and may
be unlawful. Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability for any
errors or omissions.
**********************************************************************************************


More information about the Tutor mailing list