I’m looking for a better way to name everything in Python. Yes, I’ve read PEP8, Spolsky’s wonderful rant, and various other articles. But I’m looking for more guidance in choosing the actual words.
And yes I know
A Foolish Consistency is the Hobgoblin of Little Minds.
But, you can keep consistent with PEP8 etc, and still not have consistent variable/method/class names which are easy to remember. By consistent, I mean that if you were presented with the same decision twice, you would produce the same name.
As an example, there are multiple PEP8 compliant ways to name the items below:
- number of columns in the table
- current column number
- column object
- sum of column
Yeah, sure, it is easy to make a decision to use something like num_col
and count_col
rather than col_num
and col_count
(or v.v.). But, I would like to see an example that has seen some testing/refining over time. I often start with a given convention, and then it starts to break down as I venture into a new area.
I guess what I am looking for is not only what the prefix/root/tag/suffix should do (which was partly covered for Apps Hungarian in the Spolsky article), but (many) examples for each, or a rule for generating each.