newbie: self.member syntax seems /really/ annoying

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Thu Sep 13 11:32:16 EDT 2007


On Thu, 13 Sep 2007 16:30:36 +0200, BJörn Lindqvist
wrote:


> And I agree with the OP that the convention is really annoying.
> 
>   self.rect.width = self.foo(self.rect.x + self.rect.y) * self.boo()
> 
> is much less concise than
> 
>   s.rect.width = s.foo(s.rect.x + s.rect.y) * s.boo()


Y do u thnk bng cncis is lwys a gd thng?

Being concise is not always a good thing. I notice that you separate 
terms with spaces, even when Python itself doesn't need them. You also 
are happy to use infix notation, which requires brackets, instead of a 
postfix or RPN language that doesn't. You also have attributes named 
"rect" and "width" instead of "r" and "w":

s.r.w=s.f(s.r.x+s.r.y)*s.b()

There. See how much more readable that isn't?


-- 
Steven



More information about the Python-list mailing list