[Tutor] Tutor Digest, Vol 111, Issue 24

Jim Mooney cybervigilante at gmail.com
Fri May 10 21:02:21 CEST 2013


>> BTW, does your "better name" mean that camelCaps are discouraged in
>> Python?
>
> No, although most Python modules are all lowercase. But I really meant that
> your module should be for more than just making lists, it should eventually
> have all the functions needed to manage the list.
>
> Eventually maybe even a class to encapsulate those functions
> as methods.

Good point. But I'm just making a test list for now to feed into a
sort program, so I'll gussy it up later. I'm not using sort(), so I
can get the practice of raw-coding sorts. Since getting indexes is
roundabout in a Py for-loop, I'll have to think about the best
algorithm ;')

As regards camelCaps, all I see in the Py Lib is underlines, so I
guess that's more of a convention and I might as well stick to it,
since some programs might become modules. I don't want to spend
forever deciding what style to use, when I could be programming. I see
there is a proposed manual of style at
http://www.python.org/dev/peps/pep-0008/ so I'll look at that.

I think both camelCaps and underlines are often artifacts having to
use short names years ago.

A plain language phrase that isn't hard to spell or almost purposely
confusing (like repeated letters on a word boundary) should do most
times without camelCaps or underlines, unless you really need them for
clarity, so I'll go with underlines, but only when needed for clarity.
And of course, a plain, descriptive name makes a program almost
self-documenting, so you save on hashmarks.

I'm using Windows, which doesn't recognize case difference, so camel
caps for a program name are confusing, anyway. I never figured why
Msoft did that. Even in normal English, cASe is enfOrcEd for good
reason. By trying to make it simpler, Msoft made it harder (Not the
first time that's been done ;')

Since this is a beginner list, I think bringing up Python Preferred
Style is reasonably on topic. I'm a retired webmaster, so readability
and idiot-proofing are a BIG item with me.

Jim


More information about the Tutor mailing list