Why 'self' ?

Steven D. Majewski sdm7g at Virginia.EDU
Wed Oct 31 13:30:12 EST 2001


On Wed, 31 Oct 2001, Schaefer, F. wrote:

> Hi all,
> 
> It's been a while that I am working with Python and actually
> the only thing I really do not like about it is 'self' in the
> member function definitions as argument. If it
> has to be there anyway, it is totally redundant to write it.
> 
> So, why is self there ?

If you compare the ratio of:
	 Smallest-Program-Length / Average-Program-Length
you will find that most programs are largely redundant. 
As with the English Language, we suspect that most of that
excess redundancy aids human comprehension of the program. 

We could also eliminate all explicit function arguments and
pass them as an implicit tuple named 'args' . Then we could
eliminate all redundant argument declarations in the function
and method definitions and just process args[0], ..., args[n]. 

I'm sure there are a lot of redundancies we can eliminate from
Python, but rather than looking for them piecemeal, I would
rather start fresh with a more effecient plan: 

[1] Enumerate all possible computer programs. 
[2] Label each one with an integer. 
[3] Use that integer to represent the program. 


( Any one remember the old joke about the prison with only one  
  book -- a jokebook -- in the prison library? Did *that* joke
  have a number, or did Russell prove that if you gave it a 
  number, the whole universe would fall into a black hole? 
  I suspect that Douglas Adams knew it was Joke #42, but he 
  couldn't explicitly explain it because it would have made 
  the story so self referential that he would have been sucked 
  into a 





More information about the Python-list mailing list