Too many 'self' in python.That's a big flaw in this language.

Lou Pecora pecora at anvil.nrl.navy.mil
Thu Jun 28 08:48:10 EDT 2007


In article <mailman.118.1182952889.22759.python-list at python.org>,
 "Jorgen Bodde" <jorgen.maillist at gmail.com> wrote:

> I had the same feeling when I started, coming from a C++ background, I
> forgot about self a lot, creating local copies of what should be an
> assign to a class instance, or methods that could not be found because
> I forgot 'self' .
> 
> Now I am 'kinda' used to it, as every language has some draw backs
> (you can't please all). But, what about something in between like only
> using the dot (.) for a shorter notation?
> 
> self.some_var = True
> 
> Could become:
> 
> .some_var = True
> 
> Which basically shows about the same thing, but you leave 'self' out
> of the syntax. Ofcourse it should not be allowed to break a line
> between the dot and the keywords, else Python would never know what to
> do;
> 
> my_class()
> .my_var = True
> 
> Should not be parsed the same as;
> 
> my_class().my_var = True
> 
> Just a suggestion. I am pretty happy with self, but I could settle for
> a shorter version if possible.
> 
> - Jorgen

Hmmm... I like this idea.  Would you put a dot in the argument of a 
class method?

  def afcn(.,x,y):
      # stuff here

??

I still like it.  self remains a wart on python for me after 5 years of 
use despite a deep love of the language and developers' community.

-- 
-- Lou Pecora

When I was a kid my parents moved a lot, but I always found them.
      (R.Dangerfield)



More information about the Python-list mailing list