Why we don't use underbars

Martin Geisler mg at aragost.com
Fri May 6 02:46:32 CDT 2011


Dirkjan Ochtman <dirkjan at ochtman.nl> writes:

> On Fri, May 6, 2011 at 09:23, Martin Geisler <mg at aragost.com> wrote:
>> My feeling is that we have to look at the code anyway to remember the
>> name of the constant. We might memorize the name of the constant after a
>> while, but that includes memorizing the position of any underbars. At
>> least this is my experience.
>
> Meh. Maybe that works for you, but I'm pretty sure consistency is
> king. That way, you don't have to remember the way the variable is
> spelled, you can just remember the words in it and figure out the
> spelling from your knowledge about the coding style.

But my point is that I cannot remember the words without also
remembering where the underbars is. I'm constantly opening .py files to
find the name of the function to call, the name of the arguments etc.

> Not obeying the coding style is pretty much like putting typos in your
> variable names. Do you really want to argue that it doesn't matter
> because you'll get it right after you've looked at the misspelled
> name?

The coding style could go both ways: with or without underscores. If I
have to remember the words anyway, then it's just a matter of doing

  ''.join(words)

or

  '_'.join(words)

in my head -- the latter is often more readable.

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://mercurial.aragost.com/kick-start/


More information about the Mercurial-devel mailing list