newbie: self.member syntax seems /really/ annoying
Wildemar Wildenburger
lasses_weil at klapptsowieso.net
Thu Sep 13 10:16:03 EDT 2007
Steven D'Aprano wrote:
> On Thu, 13 Sep 2007 12:10:03 +0000, timothy.soehnlin 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.
>
>
OK, making a pointless reply to pointless reply, but anyway:
I see merit in using
(_.foo + _.bar) * _.baz
instead of
(s.foo + s.bar) * s.baz
because I'm trained to interpret the underscore as a synonym for one
space. It's not particularly beautiful, but that is probably a matter of
habituation. And that exact word is probably the reason why I'd still
use self or s (explained by a comment, because I can get very dumb if I
have to).
It's a matter of taste, so there is no point in bashing a valid suggestion.
/W (I am aware that I'm banging a philosophy on people's heads just as
Steven did, so I'm no better, I know.)
More information about the Python-list
mailing list