Why we will use obj$func() often

Donn Cave donn at u.washington.edu
Fri Apr 23 16:21:30 EDT 2004


In article <mailman.975.1082746267.20120.python-list at python.org>,
 "Mike C. Fletcher" <mcfletch at rogers.com> wrote:
> Mark Hahn wrote:
> >"Mike C. Fletcher" <mcfletch at rogers.com> wrote ...
> >
> >  
> >
> >>$ is basically a character as far as glyphs go, it's a
> >>full-height glyph with ascenders and descenders, is very similar to a
> >>capital S, and generally makes reading code much harder as it obscures
> >>word-shape; .this or even self.this is much easier to read because you
> >>can pick out the words using your learned vocabulary of word-shapes.
> >>    
> >>
> >
> >Well I have a problem now.  I gave people on my mailing list a choice
> >between $var, `var, ~var,  and ^var.  The current tally is four votes for
> >$var and none for any of the others.  According to your criteria, $var is
> >the worst and ~var should be the best.  Am I correct?
>  
>
> Depends on the font ;) .  Certainly $ is going to have the most 
> (negative) impact on readability, but the other three are all basically 
> lightweight enough that they don't read as characters (basically any 
> glyph that fills the same space as a lower-case o is going to markedly 
> change the shape of a word.  ` is the least likely to be read as a 
> character, but is really hard to distinguish from ', so likely not a 
> great choice.  ^ doesn't occupy the middle space, so doesn't get read as 
> a character either.  ~ doesn't read as one either because it doesn't 
> touch the baseline.
> 
> $, however, is going to be familiar to your PERL aficionados, and 
> familiarity counts a lot for those who are familiar with it, regardless 
> of whether it's technically easier to read.  The other three are 
> basically just arbitrary punctuation, so people don't have any 
> associations built up with them (they don't look at them and 
> automatically think "attribute access").  The dot character does have 
> lots of attribute-access associations; hence a leading dot (which 
> doesn't read as a character) will tend to test favourably on both scales 
> (practical and familiar).

Hm, I do have some associations with the other three, and
also with $ in an infix position.  Maybe I have more junk
than usual in my mental closet, but we are supposed to
venerate the aged so I will report without embarrassment
that I remember VMS library functions like RMS$PARSE etc.
This basically goes along with the argument above - it's
a single identifier, $ is not punctuation.  VMS is still
around, too.

The C use of ~ (bitwise negation operator) and ^ (bitwise
xor) should be a problem, but otherwise I guess ~ seems
like a character to me too.  In an infix position.  hi~ho
vs. hi_ho, same look to me.  They are also operators in
the Plan 9 rc shell, incidentally - glob match and distributive
concatenation, respectively.

Any of the four would be an unhappy choice, in my view.
Maybe there's some way to use :

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list