Do I always have to write "self." ?
Louis M. Pecora
pecora at anvil.nrl.navy.mil
Sun Apr 30 16:08:00 CEST 2000
In article <m3bt2tonyg.fsf at atrus.jesus.cam.ac.uk>, Michael Hudson
<mwh21 at cam.ac.uk> wrote:
> > Thinking about readability, I wrote the C++ coding standard here
> > where I work. When we programmers reviewed it, a co-worker
> > insisted that part of our standard be to prefix the names of all
> > member variables in any class with "m_" so that we could
> > distinguish them from other variables. I believe that "m_" is a
> > Microsoft-ism and in my humble opinion is just another way to spell
> > "self.". I think this shows that even C++ programmers are capable
> > of seeing the wisdom of the Pythonic way.
> I have unpleasant memories of trying to understand C++ code that named
> a *local* variable m_something. Bleargh. Unambiguous is good.
Isn't this called something like "Hungarian" variable naming? It has
somethig to do with the Hungarian language IIRC. There was a whole
movement (maybe it took refuge at Microsoft) which prepended all
variable names with a letter that referred to it's "namespace." E.g.
use g for global variables: gChannel, gSocket1, etc. I thought it was
an aberration. Ugly! A suffix would be much more readable: Channelg,
Socket1g etc. But even then...
More information about the Python-list