newbie: self.member syntax seems /really/ annoying

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Thu Sep 13 18:42:28 EDT 2007


On Thu, 13 Sep 2007 12:47:27 -0700, Carl Banks wrote:

> On Sep 13, 9:55 am, Steven D'Aprano <st... at REMOVE-THIS-
> cybersource.com.au> wrote:
>> On Thu, 13 Sep 2007 12:10:03 +0000, timothy.soehn... at gmail.com wrote:
>> > Why not use '_' as the self variable.  It is minimal and achieves
>> > close to '.var', as '_.var' isn't that different.  I know its a
>> > little perl-esque, but its not a bad convention if you are aiming to
>> > up readability of your code.
>>
>> I think the definitions of "up" or "readability" you are using are very
>> different from mine. To me, to up something means to increase it, and
>> readability means the ease of comprehension when reading something. You
>> seem to be using the opposite definition for one or the other.
> 
> 
> He's not.  People who've never done a lot of numerical programming might
> have a hard time understanding this, but what is considered readable for
> "ordinary" programming is just does not apply when reading and writing
> pages of mathematical formulae.

Teaching your grandmother to suck eggs. I'm not a professional coder, but 
I'm not a stranger to numerical programming either.

[snip]

> The most readable numerical code looks as much like the printed
> equations as possible.  "self." is a distraction; it's not in the
> original formula; it's boilerplate.  It takes away from the readability
> of the code.  Assuming that you can't get rid of the attribute syntax,

Why would you assume that?

Go back to the beginning of this thread, and you'll see that I suggested 
that the Original Poster stop forcing his maths functions into classes 
and put them in functions where they belong. As far as I'm concerned, 
this thread has clearly evolved to no longer be specifically about the 
OP's problem that classes don't read like maths functions (that's a 
solved problem -- don't use classes) and is now discussing the generic 
issue that some people don't have good taste when it comes to programming 
languages.


-- 
Steven.



More information about the Python-list mailing list