"self" in a class is annoying and errorprone

Afanasiy abelikov72 at hotmail.com
Wed Feb 12 13:36:42 EST 2003


On Wed, 12 Feb 2003 11:30:15 +0100, Meinrad Recheis
<meinrad.recheis at aon.at> wrote:

>hello everyone,
>
>I think it must be possible to change python so that self can be omitted 
>inside a class
>	# except for some reasons like this:
>	__init__(""" i dont like this self """ self, x)
>		self.x = x    # here self is useful
>	
>
>self is simply annoying.
>(why allways need self as first parameter?? the interpreter could mask 
>that for us)
>self is prone to be forgotten!! leads to potential scope errors
>would make source code shorter, and more beautiful

I agree, but the FAQ says it was easier to do it this way.
This same reason shows itself in other Python decisions.

http://www.python.org/cgi-bin/faqw.py?req=show&file=faq06.007.htp

I personally do not agree with it, but the FAQ does try
to convince us, and the author?, it was a good choice,
even if it was selected for the creator's ease.

It makes me wonder if I want a language whose core features
and design additions are first selected for their ease.





More information about the Python-list mailing list