"self" in a class is annoying and errorprone

Manuel Garcia news at manuelmgarcia.com
Wed Feb 12 14:24:19 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
>
>shouldn t that be discussed for the sake of PYTHON?
>
>- Meinrad

Python is not for everyone.  Perl and Ruby are also very good.  Perl
and Ruby do not force you to use a variable like 'self'.

We have 3 general purpose scripting languages, all with powerful
built-in data structures, all open-source, all with BSD-like licenses,
and all with portable & efficient implementations.  It is an
embarrassment of riches.

Personally, I like using 'self'.  Expectorant is better than Insipid.
I may be misquoting ;-)

Manuel





More information about the Python-list mailing list