CamelCase versus wide_names (Prothon)

Michael Geary Mike at DeleteThis.Geary.com
Tue Apr 20 12:20:48 EDT 2004


> Max M wrote:
> > Make . a normal letter.
> >
> > And make _ have the function that . has in Python, so that _ and . sort
> > of switches meaning.
>
> def install.sub.skin(self, out, skin.folder):
>      """Install a subskin"""
>
>      skins.tool = get.tool.by.name(self, 'portal.skins')
>
>      for skin in skins.tool_get.skin.selections():
>          path = skins.tool_get.skin.path(skin)
>          path = map(string_strip, string_split(path,','))
>          if not skin.folder in path:
>              try:
>                  path_insert(path_index('custom')+1, skin.folder)
>              except value.error:
>                  path_append(skin.folder)
>              path = string_join(path, ', ')
>              skins.tool_add.skin.selection(skin, path)
>              out_write('Subskin successfully installed into %s\n' %
> skin)
>          else:
>              out_write('*** Subskin was already installed into %s\n' %
> skin)
>
>
> It is allmost freakish how hard that is to read.

Interesting... I think you're kidding around, but I actually like that
notation quite a bit.

The problem I have with names_with_underscores is that the underscore adds
too much separation between the words, causing visual confusion over which
word belongs to which name. This is especially true in a proportional font.
Consider one of the function calls in your code, and for a moment forget
your expectations from Python, C, and similar languages:

      skins.tool_get.skin.selections()

If you view that in a proportional font, the visual grouping is vivid:
skins.tool is one unit, and get.skin.selections is a separate unit. That big
fat underscore is more than twice the width of the tiny little periods, so
that's where the visual break occurs.

Compare it with the traditional:

      skins_tool.get_skin_selections():

When I read that code in my mind (again viewing it in a proportional font),
I have to make an effort to prevent myself from pronouncing it this way:
"skins" (pause) "tool get" (pause) "skin" (pause) "selections". After all,
the words "tool" and "get" have only that tiny period in between, while
there is a much larger distance between the other words. (In the font I'm
viewing this in, underscore is 2.2 times the width of period, and 2.75 times
the width of an actual space character!)

Of course, in a monospaced font, period, underscore, and space are all the
same width, and so many languages use underscore as an "alphanumeric"
character and period as a separator that it would probably be confusing to
do otherwise.

But it's interesting how a proportional font stands all of this on its head,
with underscore being so much wider than the other punctuation marks.

-Mike





More information about the Python-list mailing list