Getting rid of "self."

Roy Smith roy at
Fri Jan 7 23:59:07 EST 2005

Jeremy Bowers <jerf at> wrote:
> were I programming in C++ routinely now I'd prefix "this" and 
> dispense with that ugly "m_" garbage. (One of the things I ***hate*** 
> about C++ culture is its acceptance of hideously ugly variable names, 
> but now I'm two parentheticals deep so I probably ought to stop.))

I'm currently working in a C++ system where they have a wrapper class 
that provides some transaction locking functionality for member access.  
The colloquial name for the wrapped "this" pointer is self, i.e. they do 
"self = wrapper (this)" at the beginning of functions that need it.  You 
can then do "member" to get the bare access or "self.member" to get the 
locking functionality.

It's actually kind of neat, but boy does it play headgames with me when 
I switch back and forth between that and Python.

More information about the Python-list mailing list