[Python-Dev] OT: style convention: self vs. _ in new Norvig's book

Anthony Baxter Anthony Baxter <anthony@interlink.com.au>
Tue, 22 Jan 2002 11:14:37 +1100


>>> Peter Norvig wrote
> That may be a good analogy, and as I said, I'm willing to try.  But I
> still think one character is easier to ignore than four, and that there
> is no compelling argument for 'self' over '_', while there is a positive
> reason for parens (ease of automated parsing tools). 
 
The primary arguments against '_' are that it already has meaning. I can 
think of three, off the top of my head.
  Interactive mode uses this as "result of last expression".
  The i18n code uses it as a function _('translate me').
  Zope uses it in DTML (python) expressions as the default namespace.

I'd also add the subjective argument that it's ugly, and looks far too
magical and perl-like. I don't _want_ it to disappear into the background,
as it's going to cause me pain if I miss it.

Anthony